slachiewicz opened a new issue, #13405:
URL: https://github.com/apache/maven/issues/13405

   ### Affected version
   
   4.0.0-rc-7 (same code on master and maven-4.0.x)
   
   ### Bug description
   
   Maven 4 does not start when the project has `.mvn/jvm.config` and any of 
`JAVA_TOOL_OPTIONS`, `_JAVA_OPTIONS` or `JDK_JAVA_OPTIONS` is set. Maven 3.9.16 
and 3.10.0 build the same project.
   
   ```
   $ cat .mvn/jvm.config
   -Xmx512m
   $ JAVA_TOOL_OPTIONS=-Dfoo=bar mvn -o validate
   Picked up JAVA_TOOL_OPTIONS: -Dfoo=bar
   Error: Could not find or load main class Picked
   Caused by: java.lang.ClassNotFoundException: Picked
   ```
   
   With `JDK_JAVA_OPTIONS` the class is `NOTE:`, from the JVM's `NOTE: Picked 
up JDK_JAVA_OPTIONS` line. The exit code is 1.
   
   `concat_lines` in `bin/mvn` (line 402 on master, 208 on maven-4.0.x) has 
captured the output of `JvmConfigParser.java` with `2>&1` since #11365. The JVM 
that runs the parser prints its "Picked up …" notice on stderr, so the notice 
becomes part of the JVM options, and its first word is taken as the main class. 
`JAVA_TOOL_OPTIONS` is common on CI runners and in containers, and 
invoker-based integration tests set it to tune the forked JVMs.
   
   Capturing only stdout would fix it, with stderr shown only when the parser 
exits non-zero. I have not checked `mvn.cmd`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to