【问题标题】:How to specify the JNLP output file when using javafx-maven-plugin for creating a javafx native installer?使用 javafx-maven-plugin 创建 javafx 本机安装程序时如何指定 JNLP 输出文件?
【发布时间】:2016-03-02 21:57:39
【问题描述】:

我正在使用 maven 插件 https://github.com/javafx-maven-plugin/javafx-maven-plugin 为 javafx 应用程序生成安装程序。我可以创建一个exe并成功运行它。问题是我无法生成 jnlp 文件。 我看到以下消息

[INFO] Skipping WebStart JNLP Bundler because of configuration error No OutFile Specificed
Advice to Fix: Please specify the name of the JNLP Outut file in 'jnlp.outfile'

在哪里以及如何设置 JNLP 输出文件的名称?

【问题讨论】:

    标签: maven javafx


    【解决方案1】:

    要生成 JNLP 文件,您必须稍微调整一下配置:

    <plugin>
        <groupId>com.zenjava</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>8.2.0</version>
        <configuration>
            <mainClass>com.zenjava.test.Main</mainClass>
            <verbose>true</verbose>
            <appName>YourAwesomeProject</appName>
            <bundleArguments>
                <!-- to include "dtjava.js" and other related files, set this to TRUE -->
                <jnlp.includeDT>true</jnlp.includeDT>
    
                <!-- the JNLP-bundler needs this, they don't use "appName" for the filename ... you have to set this, otherwise it doesn't build -->
                <!-- for details of that JNLP-bundler, please have a look at the source -->
                <!-- https://github.com/Debian/openjfx/blob/e32fd960e20c58c9b7db27e426b4bca6d52add2f/modules/fxpackager/src/main/java/com/oracle/tools/packager/jnlp/JNLPBundler.java#L84 -->
                <jnlp.outfile>YourAwesomeProject</jnlp.outfile>
            </bundleArguments>
        </configuration>
    </plugin>
    

    您需要调用 mvn jfx:native 而不是 mvn jfx:web,因为 Oracle 正在将 JNLP 生成移动到新的内部形式,删除一些 com.sun.*-packages。

    要仅生成 JNLP,您可以通过在配置中指定 &lt;bundler&gt;jnlp&lt;/bundler&gt; 来缩短构建时间。

    免责声明:我是那个 maven-plugin 的维护者。

    【讨论】:

    • 我可以使用 javafx-maven-plugin 部署 javafx 应用程序和 web start。但是当我向 pom 添加其他依赖项(fontawesome jar)时,jar 被复制到 lib 目录。 jnlp 文件中 jar 的路径是 这会导致错误 xitException[3]com.sun.deploy.net .FailedDownloadException:无法加载资源:localhost:8080/installer/lib\fontawesomefx-8.9.jar.当我通过将反斜杠更改为正斜杠来修改路径时,它可以工作。正确的路径localhost:8080/installer/lib/fontawesomefx-8.9.jar
    • 可能是一个 bug,我已经打开了一个 bug-ticket 进行分析:github.com/javafx-maven-plugin/javafx-maven-plugin/issues/182
    • @user68883 你知道,这是 JDK 本身的一个错误,我将为此创建一个解决方法;)感谢您的发现!
    • 另外我们如何签署 jar ?当我尝试使用 maven-jarsigner-plugin 签名时,它会签署由 maven 创建的原始 jar,但不会签署以 -fx.jar 结尾的 jar 文件(由该插件创建的 jar)?我们如何签署 jar 和所有依赖项?
    • @user68883 我得看看新的捆绑器,也许我必须调整 javafx-maven-plugin 来签署这些文件。他们是使用另一个 maven-goal mvn jfx:web 签署的,但是该类将被删除(正如我在这个 SO-question 的答案中提到的那样)。目前似乎没有什么容易的。将打开该项目的另一个问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-23
    • 1970-01-01
    • 2011-02-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多