Right, it depends on if you want modular or non-modular and that is generally
predicated by what kind of dependencies you include that you cannot influence.
If you want a non-modular binary you can use a shaded JAR with a launcher class
that literally calls the main method of the main that extends the JavaFX
Application. and Jlink. You’ll obviously need to include all the JavaFX
dependencies.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>${maven.compiler.version}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<mainClass>${mainClass}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>project-classifier</shadedClassifierName>
<outputFile>${project.build.directory}/jar/${project.artifactId}.jar</outputFile>
<transformers>
<transformer implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${launcherClass}</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Simply run this and you’ll get an executable binary for the platform you are
running.
mvn org.openjfx:javafx-maven-plugin:0.0.3:jlink
If however, you want a modular project it’s somewhat more complex but
nonetheless doable; you could follow my tutorial on DZone[1]. It does need
updating a little - in that you can use the JDK 14ea JPackage to do the
packaging now but it is generally all still applicable.
Hope this helps!
On 1 Dec 2019, at 11:03, joe schmo
<[email protected]<mailto:[email protected]>> wrote:
I have created a javafx application using Netbeans 11.1, it is a maven based
project. I want to create a deployable executable jar file. Is there a good
tutorial or documentation on how to do this with Netbeans/maven?
Thanks
CONFIDENTIALITY NOTICE This message and any included attachments are from
Cerner Corporation and are intended only for the addressee. The information
contained in this message is confidential and may constitute inside or
non-public information under international, federal, or state securities laws.
Unauthorized forwarding, printing, copying, distribution, or use of such
information is strictly prohibited and may be unlawful. If you are not the
addressee, please promptly delete this message and notify the sender of the
delivery error by e-mail or you may call Cerner's corporate offices in Kansas
City, Missouri, U.S.A at (+1) (816)221-1024. Cerner Limited, Registered in
England no 2519305, Registered Office 37 North Wharf Road, London W2 1AF.