maven executable jar with fxml files in javaFX


Question

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.

1
0
1/28/2013 4:10:02 PM

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.

1
6/17/2017 7:05:56 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon