I'm working migrating my Maven JavaFX app from Java 8 to Java 11. Iv'e updated the plugins in my pom.xml to the most current (Java 11 compliant) plugins. Compilation runs fine, giving me the jars and all dependencies and modules in the right directories under the "target" folder but when I try to run my jar file I get the dreaded "Missing JavaFX application class " error. No matter how I try to change the plugin configuration - I always get this error msg and the app won't run.
Now, more findings : 1. The main class DOES reside in the right folder under classes and in the jar. 2. The Manifest file is in the right place and contains the main class attribute (which worked fine under Java 8).
Here is the relevant part of the
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<release>11</release>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerVersion>11</compilerVersion>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>7.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>false</addClasspath>
<mainClass>${mainClass}</mainClass>
</manifest>
<manifestEntries>
<JavaFX-Application-Class>${mainClass}</JavaFX-Application-Class>
</manifestEntries>
</archive>
<outputDirectory>${project.build.directory}/libs</outputDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-libs</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/libs</outputDirectory>
<includeScope>runtime</includeScope>
<excludeGroupIds>org.openjfx</excludeGroupIds>
</configuration>
</execution>
<execution>
<id>copy-modules</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/mods</outputDirectory>
<includeScope>runtime</includeScope>
<includeGroupIds>org.openjfx</includeGroupIds>
</configuration>
</execution>
</executions>
I'm running the jar by including the JavaFX modules as described in the documentation :
java -verbose --module-path ../mods \
--add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.swing \
-jar jar-file-name.jar \
package.class.MainClass
In my frustration Iv'e tried endless configurations, including using the configuration from the JavaFx Java 11 samples. Nothing works.
Any ideas?