javafx-maven-plugin
javafx-maven-plugin copied to clipboard
commandlineArgs doesn't work with javafx:jlink goal
I have defined the commandlineArgs
parameter, but it's never added to launcher.
I'm using Java 17 on Linux.
Configuration:
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<stripJavaDebugAttributes>true</stripJavaDebugAttributes>
<compress>2</compress>
<noHeaderFiles>true</noHeaderFiles>
<noManPages>true</noManPages>
<launcher>appName</launcher>
<options>-Xmx7G -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dcom.sun.javafx.isEmbedded=true -Dcom.sun.javafx.touch=true -Dcom.sun.javafx.virtualKeyboard=javafx</options>
<commandlineArgs>test1 test2</commandlineArgs>
<jlinkImageName>appImageName</jlinkImageName>
<jlinkZipName>appName_${project.version}</jlinkZipName>
<mainClass>com.example/com.example.App</mainClass>
<jlinkVerbose>false</jlinkVerbose>
<jmodsPath>${project.build}/dependency</jmodsPath>
</configuration>
</plugin>
Expected launcher:
#!/bin/sh
JLINK_VM_OPTIONS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dcom.sun.javafx.isEmbedded=true -Dcom.sun.javafx.touch=true -Dcom.sun.javafx.virtualKeyboard=javafx"
DIR=`dirname $0`
$DIR/java $JLINK_VM_OPTIONS -m com.example/com.example.App test1 test2 "$@"
Actual launcher:
#!/bin/sh
JLINK_VM_OPTIONS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dcom.sun.javafx.isEmbedded=true -Dcom.sun.javafx.touch=true -Dcom.sun.javafx.virtualKeyboard=javafx"
DIR=`dirname $0`
$DIR/java $JLINK_VM_OPTIONS -m com.example/com.example.App "$@"
If I understand correctly, <commandlineArgs>
is a javafx:run
option, which appears to work as expected. It looks like you can pass the same command-line parameters to the launcher via the shell special variable "$@"
:
./target/appImageName/bin/appName test1 test2