具有javaFX中的fxml文件的Maven可执行jar [英] maven executable jar with fxml files in javaFX

查看:112
本文介绍了具有javaFX中的fxml文件的Maven可执行jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个可执行jar.我读过如何制作MANIFEST.MF,但我读过maven则容易得多:

I want to create a executable jar. I read how to make a MANIFEST.MF, but I read with maven is pretty much easier:

http://www.springone2gx.com/blog/scott_leberknight/2008/06/creating_executable_jars_using_the_maven_assembly_plugin

,但是该解决方案不包含fxml文件.

but that solution doesn't include the fxml files.

您是否知道该插件或一些教程,它们解释了如何以及在何处插入fxml文件.

Do you know a plugin for that or some tutorial that explain how and where I should insert the fxml files.

我注意到解决方案也不包含gif或其他文件.因此,我认为应该是相同的解决方案,以将其他类型的文件包含到jar中.

I noted that solution doesn't include gif or other file to jar too. So, I think that the should be a same solution to include other types of files to jar.

我快到截止日期(昨天)了.因此,只要允许我在5分钟内(任何人都可以做梦)的帮助,都将非常受欢迎.

I'm near to deadline (yesterday). So any help that permit me make it in 5 min (anyone can dream) will be more than welcome.

谢谢.

推荐答案

您可以为此使用Zenjava-Javafx-maven-plugin.只需将其添加到您的pom.xml

You can use Zenjava-Javafx-maven-plugin for this. Just add this to your pom.xml

<plugin>
    <groupId>com.zenjava</groupId>
    <artifactId>javafx-maven-plugin</artifactId>
    <version>8.8.3</version>
    <configuration>
        <mainClass>your.package.with.Launcher</mainClass>
    </configuration>
</plugin>

比使用mvn jfx:jar命令创建javafx jar. jar-file将放置在target/jfx/app.

Than use mvn jfx:jar command to create javafx jar. The jar-file will be placed at target/jfx/app.

如果您希望创建javafx本机包,请使用此配置,

If you wish to create a javafx native bundle, use this configuration,

<plugin>
    <groupId>com.zenjava</groupId>
    <artifactId>javafx-maven-plugin</artifactId>
    <version>8.8.3</version>
    <configuration>
        <vendor>YourCompany</vendor>
        <mainClass>your.package.with.Launcher</mainClass>
    </configuration>
</plugin>

和以下命令:mvn jfx:native.本机启动程序或安装程序将放置在target/jfx/native.

and this command: mvn jfx:native. The native launchers or installers will be placed at target/jfx/native.

这篇关于具有javaFX中的fxml文件的Maven可执行jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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