Yashisinghal285 opened a new pull request, #13447: URL: https://github.com/apache/maven/pull/13447
Fixes #13405 ### Problem In `bin/mvn`, `concat_lines` executes `JvmConfigParser.java` and captures output with `2>&1`. When `JAVA_TOOL_OPTIONS`, `JDK_JAVA_OPTIONS`, or `_JAVA_OPTIONS` is set, the JVM prints notices such as `Picked up JAVA_TOOL_OPTIONS: ...` to `stderr`. Because `stderr` was merged into `stdout`, the notice was captured into `MAVEN_OPTS`, causing the JVM to treat `Picked` (or `NOTE:`) as the main class name on launch. ### Solution - Separate stdout from stderr when executing `JvmConfigParser.java` in `bin/mvn`. - Redirect stderr to a temporary file and only display it if the parser exits with a non-zero code. - Added `test-mvn-jvm-config.sh` to verify that JVM notices do not pollute JVM arguments and that parser errors are still reported. - Added the test script to the `shell-script-tests` profile in `apache-maven/pom.xml`. *Note: Please consider backporting to `maven-4.0.x` as well, as this affects 4.0.0-rc-7.* ### Verification Verified with Git Bash / POSIX test runners: - `sh apache-maven/src/test/scripts/test-mvn-jvm-config.sh` (all assertions pass) - `sh apache-maven/src/test/scripts/test-mvn-path-conversion.sh` (all assertions pass) --- To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) check one of the following: - [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) - [ ] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- 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]
