You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I thought, why not try exec-maven-plugin too, maybe you can get it to work, too.
So I need to inject the module path into the java command line.
So I achieved this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<executable>java</executable>
<arguments>
<argument>--module-path</argument> <!-- inject string into the command line -->
<modulepath/> <!-- inject the module path based on what's in the local maven .m2 repo -->
<argument>--add-modules</argument> <!-- inject string into the command line -->
<argument>javafx.controls,javafx.fxml,javafx.web,javafx.graphics,javafx.media</argument> <!-- inject string into the command line -->
<argument>-classpath</argument> <!-- inject string into the command line -->
<classpath/> <!-- inject dependencies from the local maven .m2 repo -->
<argument>org.openjfx.App</argument> <!-- the program -->
</arguments>
</configuration>
</plugin>
Running mvn -X exec:exec reveals that the generated command line is
<argument>--module-path</argument> <!-- inject string into the command line -->
then the module path is injected into the command line directly (instead of the reference to the file modulepath) but without option -p prepended, leading to failure. Really weird, it would be much better for the plugin to bail out at once with a clear message here.
The text was updated successfully, but these errors were encountered:
Trying to run a JavaFX program with the
exec-maven-plugin
, rather than thejavafx-maven-plugin
.The latter works flawlessly, for anyone interested the declaration is
But I thought, why not try
exec-maven-plugin
too, maybe you can get it to work, too.So I need to inject the module path into the java command line.
So I achieved this:
Running
mvn -X exec:exec
reveals that the generated command line isThis means the
--module-path
string was not injected.Instead java is told to look for file
@/home/aloy/IdeaProjects/compile_javafx/target/modulepath
which has indeed been created.This behavior is not documented at https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-for-java-programs.html
But the JavaFX program can actually run!
Note that if one removes
then the module path is injected into the command line directly (instead of the reference to the file
modulepath
) but without option-p
prepended, leading to failure. Really weird, it would be much better for the plugin to bail out at once with a clear message here.The text was updated successfully, but these errors were encountered: