Required to build the application.
When creating a project, I chose java fx .
How to convert a project to maven and correctly assemble it into an executable file?
2 answers
To convert Intellij Idea CE in the current version:
- Right click on the project name in the
Projectmenu - In the context menu, select
Add Framework Support... - In the dialogue mark
Maven OK- Correct the package names in * .java and the paths to / to * .fxml, since Maven has his own opinion, how things should be arranged, and the project converter does not fix this (therefore I chose Gradle for myself).
To get a portable Windows program, you need two plug-ins for Maven (also for Gradle) - the first plugin builds a thick jar (aka "fatjar", "jar with dependencies", "executable jar"), the second creates an .exe- wrapper.
By specifying the names of the first and second plug-in, you can google the darkness of the .pom examples (just remember to fix the plug-in versions for the current ones from Maven Central).
As the first Maven plug-in there are several options: maven-assembly-plugin , maven-shade-plugin , onejar-maven-plugin ... (I use the com.github.johnrengelman.shadow for my Gradle).
There is one caveat - if you have .fxml-files in the source folder (and not in the resource ), then you need to specify that they are also copied to the .jar-file, because by default, the plug-ins take only .java from the source folder. -files
As a second, I use the plugin for launch4j (for Maven this will be a launch4j-maven-plugin , for Gradle - edu.sc.seis.launch4j ).
After, as obtained .jar and .exe I add the unpacked JRE to the subfolder ./jre/ next to the .exe - the set is ready.
You can also create an installer for Windows - also a plugin for Maven / Gradle.
On eclipse: Right click on the project -> Configure -> Convert to Maven Project