简体   繁体   中英

maven executable jar with fxml files in javaFX

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

but that solution doesn't include the fxml files.

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

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.

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.

Thank in advance.

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>

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

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>

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

to create executable jar's of javaFX projects using maven follow this tutorial : from-zero-to-javafx-in-5-minutes

Using this plugin it's much, much easier to get up and running quickly and to build complicated distribution bundles (such as executable JAR files, native installers and webstart bundles)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM