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 2

    To convert Intellij Idea CE in the current version:

    1. Right click on the project name in the Project menu
    2. In the context menu, select Add Framework Support...
    3. In the dialogue mark Maven
    4. OK
    5. 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