Run mvn clean test -Dagent=true
:x: Bug: Surefire execution fails with:
Error: Could not find or load main class with-spaces\target\native\agent-output\test\session-{pid}-{datetime}
Caused by: java.lang.ClassNotFoundException: with-spaces\target\native\agent-output\test\session-{pid}-{datetime}
Expected behavior
Execution does not fail
Logs
Surefire log on console:
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C "C:\Users\...\Downloads\graalvm-jdk-17.0.8+9.1\bin\java -agentlib:native-image-agent=config-output-dir=C:\Users\...\Downloads\test-native\path with-spaces\target\native\agent-output\test\session-{pid}-{datetime} -jar C:\Users\...\AppData\Local\Temp\surefire9367496019182751827\surefirebooter-20230812135354914_3.jar C:\Users\...\AppData\Local\Temp\surefire9367496019182751827 2023-08-12T13-53-54_661-jvmRun1 surefire-20230812135354914_1tmp surefire_0-20230812135354914_2tmp"
Note how there are no quotes around the -agentlib argument.
System Info (please complete the following information):
Describe the bug Trying to run Native Image tests with the agent fails if the project directory path contains spaces.
(Might also apply when running the application with the agent.)
To Reproduce
Steps to reproduce the behavior:
path with-spaces
In that directory create a
pom.xml
file with the following content:Create the test source file
src/test/java/MyTest.java
with the following content:mvn clean test -Dagent=true
:x: Bug: Surefire execution fails with:Expected behavior Execution does not fail
Logs Surefire log on console:
Note how there are no quotes around the
-agentlib
argument.System Info (please complete the following information):
native-maven-plugin:0.9.24
Additional context The Gradle plugin might be affected as well, but I have not tested it.