如何使用 Java-11 运行 apache fop? [英] How to run apache fop with Java-11?

查看:129
本文介绍了如何使用 Java-11 运行 apache fop?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将 fop 和 Java11 与 Maven 和 Eclipse 结合使用,我可以从 xsl-fo 输入创建 PDF 文档.
但前提是我从 Eclipse 中启动程序.
我的 pom.xml 建议 Maven 将用于依赖项的所有 jar 文件复制到 lib 文件夹.准备从命令行运行.
当我尝试从命令行启动程序时,如

Using fop and Java11 with Maven and Eclipse I can create PDF documents from an xsl-fo input.
But only if I start the program from within Eclipse.
My pom.xml advises Maven to copy all jar files used for dependencies, to a lib folder. Preparing to run from command line.
When I try to start the program from command line like

java -p target/rutil-0.0.1-SNAPSHOT.jar;target/lib -m eu.ngong.rutil/eu.ngong.rutil.App

我明白了启动层初始化时出错java.lang.module.FindException:无法为 target\lib\batik-script-1.14.jar 派生模块描述符.我可以向 pom.xml 中的 fop 依赖项添加排除项,但只能看到下一条失败消息(两个模块中的相同包)等等.

I get Error occurred during initialization of boot layer java.lang.module.FindException: Unable to derive module descriptor for target\lib\batik-script-1.14.jar. I can add exclusions to the fop dependency entry in pom.xml, but only to see the next failure message (same package in two modules) and so on.

如何像 Eclipse 一样从命令行启动我的程序?我的目标是在夜间构建批处理中使用 fop.

How can I start my program from command line like Eclipse is doing? My goal is to use fop in a nightly build batch run.

您可以在此处找到我的程序的绝对最小版本.

You may find an absolute minimal version of my program here.

推荐答案

您可以将所有非模块化工件放在类路径中,并且不支持派生它们的模块信息.这些将主要被视为未命名模块.

You can put all your non modularised artifacts on the classpath and not support deriving their module information. These would be primarily treated as an unnamed module.

java --module-path target/rutil-0.0.1-SNAPSHOT.jar;target/lib/fop-2.6.jar \
     --class-path target/lib \
     --module eu.ngong.rutil/eu.ngong.rutil.App

我已在此答案中对您面临的错误进行了解释.在使用模块路径上的所有其他工件的同时解决它的直接方法可能是破解 jar 以从 MANIFEST.MF 中删除条目.

I have provided an explanation in this answer to the error that you are facing. The immediate way to solve it while using all other artifacts on modulepath as well could be hacking the jar to remove the entry from the MANIFEST.MF.

这篇关于如何使用 Java-11 运行 apache fop?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆