I'm switching over from Java 8 (Oracle JDK) to OpenJDK 11 and OpenJFX 11. I've successfully gotten my project to work in Eclipse through Maven via the clean javafx:run
command using the maven-compiler-plugin
however I am having issues building a runnable jar and windows executable. I do not need a linux or mac runnable as this project is just an internal product and we only use windows.
I have already tried several plugins such as the maven-shade-plugin
and also tried running mvm package
to no avail. I've tried this Build executable JAR with JavaFX11 from maven and this How to deploy a JavaFX 11 Desktop application with a JRE.
In the past I could just build a executable jar through Eclipse's "Export Runnable Jar" option and then creating an executable through launch4j, however this does not seem to work anymore and I understand this probably due to the modular structure of OpenJDk 9+.
I have all the JavaFX dependencies added as well as the JAXB ones that I needed and it runs in the IDE when I build it (although I can't get it to run as a Java Application Run Configuration once I made it run in Maven Run Configuration.
Here are my plugins:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<mainClass>com.tapestry.testertools.ApplicationMainFrame</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.tapestry.testertools.ApplicationMainFrame</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Here is the error message when i attempt to run mvn clean package
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.325 s
[INFO] Finished at: 2019-09-20T09:19:35-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project testertools: Fatal error compiling: invalid flag: --module-path -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException