如何使用 fop 和 java-11 设置 maven 项目?

当我使用 Apache fop和Java 11设置maven项目时,我收到警告和maven-compiler-plugin 3.8.0。NullPointerException


使用的原型在 Java 11 上运行良好,可以快速创建桌面应用程序,但前提是我不将依赖项添加到 fop-2.3。(我也想知道相同的 Java 代码如何在mvn test中正常工作,但在添加 fop 依赖项时失败。)


添加


    <dependency>

        <groupId>org.apache.xmlgraphics</groupId>

        <artifactId>fop</artifactId>

        <version>2.3</version>

    </dependency>

到 pom.xml 并使用 mvn test 运行导致


[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ checkXslt ---

[WARNING] Can't extract module name from batik-script-1.10.jar: Provider class org.apache.batik.bridge.RhinoInterpreterFactory not in module

[WARNING] Can't extract module name from xalan-2.7.2.jar: Provider class org.apache.bsf.BSFManager not in module


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project checkXslt: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile failed. NullPointerException -> [Help 1]

我想知道是否有使用 fop 依赖并为 Java 11 编译的 pom.xml。


慕斯709654
浏览 201回答 3
3回答

慕侠2389804

如果使用 fop 2.4.0-SNAPSHOT 的主干,nullpointer 问题就会消失。回到 2.3 再次给出空指针。请注意,对于 fop,仅将依赖项添加到 pom.xml。它尚未在 java 源代码中使用。警告仍然存在。

慕斯王

你有没有尝试过&nbsp;<dependency>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.apache.xmlgraphics</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>fop</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <version>2.3</version>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <exclusions>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <exclusion>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>xalan</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>serializer</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </exclusion>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<exclusion>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>xalan</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>xalan</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </exclusion>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </exclusions>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </dependency>

牛魔王的故事

我开始使用 FOP 2.3 建立一个项目;我使用了一个 module-info.java,其中包含:requires fop;requires avalon.framework.api;requires avalon.framework.impl;但是,由于 avalon 拆分包,最终我不得不推迟。当 FOP 2.4 发布时,该特定问题将消失:https ://github.com/apache/fop/commit/bd7d5048785c691e6e3e152af10805f3127b760d我之前通过自己模块化解决的 Xalan 问题:- https://github.com/plutext/xalan-j/tree/Plutext_Java11_Repackaged_Docx4j
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java