我正在尝试使用 Apache FOP 从 XML 生成 PDF 文件,但是当我导入所需的包时,会出现一系列错误。
- The package javax.xml.transform.stream is accessible from more than one module: java.xml,
xml.apis
- The package javax.xml.transform is accessible from more than one module: java.xml, xml.
apis
- The package javax.xml.transform is accessible from more than one module: java.xml, xml.
apis
- The package javax.xml.transform is accessible from more than one module: java.xml, xml.
apis
- The package javax.xml.transform.sax is accessible from more than one module: java.xml, xml.
apis
- The package javax.xml.transform is accessible from more than one module: java.xml, xml.
apis
Run Code Online (Sandbox Code Playgroud)
我尝试排除xml-apis,但没有效果。以下是依赖项:
<dependencies>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
<version>2.6</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
我还读到这个问题是在 Java 8 之后出现的。除了使用 Java 8 之外,还有其他解决方案吗?
关于此错误消息已经有几个答案:
就我而言,我在 pom 文件中的 FOP 上使用以下排除项:
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
<version>2.6</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
<exclusion>
<groupId>java.xml</groupId>
<artifactId>java.xml</artifactId>
</exclusion>
</exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud)
就我而言,问题发生在 Eclipse 中。使用 Maven 编译系统没有显示任何错误消息。我必须更新 Eclipse JRE 以使用与 Maven 相同的参数。上面的第二个链接描述了 Eclipse 问题。
| 归档时间: |
|
| 查看次数: |
4044 次 |
| 最近记录: |