Closed johanvos closed 5 years ago
This issue might be related to how the Maven plugin uses its own Launcher, and creates an isolated thread to run the JavaFX app, in the same VM.
As an alternative, running exec:exec
solves any possible issue, as it runs the app in a different process. Since it doesn't use a Launcher, the vm arguments (--module-path
and --add-modules
) need to be set, as running from command line or gradle.
For instance, the HelloFX sample's pom should be changed to:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>--module-path</argument>
<modulepath/>
<argument>--add-modules</argument>
<argument>javafx.controls</argument>
<argument>-classpath</argument>
<classpath />
<argument>HelloFX</argument>
</arguments>
</configuration>
</plugin>
+1 on changing the maven pom file for this
Thanks for the example pom.xml update @jperedadnr!
Removed exec:java in favor of javafx maven plugin
The default mvn exec:java seems to cause a number of issues, related to how maven starts the java process. For example, see https://github.com/javafxports/openjdk-jfx/issues/316
Using mvn exec:exec and defining the modules etc fixes this, but is more verbose.