exec-maven-pluginjavapackager

How do you escape spaces or quotes in javapackager's jvmProperties


I'm using exec-maven-plugin to run javapackager from java 8 to bundle a javafx application and the system properties need to contain a space in the value.

When I use <argument>-BjvmProperties=log_path=&quot;%LOCALAPPDATA%/ERMS/Desktop Alerts/&quot I get: Error: Unknown argument: Alerts /

I added a forward slash before the space, which makes javapackager run, but the argument does not seem to be passed correctly when the application runs. In the resulting app/ERMS Desktop Alerts.cfg file it comes out as -Dlog_path=%LOCALAPPDATA%/ERMS/Desktop" Alerts/

If I invoke java from the command line I can use java -Dlog_path="%LOCALAPPDATA%/ERMS/Desktop Alerts" -jar DesktopAlerts.jar and that works fine.

Any (odd) number of slashes I've added has not changed the result at all.

Edit

From javapackager itself run from cmd I have found -BjvmProperties=log_path="${env:LOCALAPPDATA}/ERMS/Desktop Alerts/" works. Now it's a matter of making exec-maven-plugin produce that argument.


Solution

  • The solution is to escape the space with a slash. <argument>-BjvmProperties=log_path=${env:LOCALAPPDATA}/ERMS/Desktop\ Alerts/</argument>

    It appears that the quotes were the issue - possibly related to https://jira.atlassian.com/browse/BAM-9234