Repository navigation
[Backport maven-4.0.x] Fix #13405: Do not capture JVM stderr notices into jvm.config options - #13530
Merged
Merged
Conversation
…tices into jvm.config options - Separate stdout from stderr in bin/mvn when executing JvmConfigParser.java - Redirect stderr to a temporary file; display it only on non-zero exit to avoid polluting MAVEN_OPTS with JVM tool notices (JAVA_TOOL_OPTIONS, JDK_JAVA_OPTIONS, _JAVA_OPTIONS) - Add test-mvn-jvm-config.sh to verify JVM notices do not pollute JVM arguments and parser errors are still reported - Register the test script in the shell-script-tests profile in apache-maven/pom.xml Backport of apache#13447
gnodet-bot
approved these changes
Oct 14, 2026
gnodet-bot
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Clean backport of #13447 — the fix correctly separates JvmConfigParser stderr from stdout via a temp file, preventing JVM environment notices (JAVA_TOOL_OPTIONS, JDK_JAVA_OPTIONS, _JAVA_OPTIONS) from polluting MAVEN_OPTS. The test validates all three env vars and the error-reporting path; confirmed it catches the bug against the unpatched script and all 12 assertions pass against the patched version.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #13447 to
maven-4.0.x.Problem
In
bin/mvn,concat_linesexecutesJvmConfigParser.javaand captures output with2>&1. WhenJAVA_TOOL_OPTIONS,JDK_JAVA_OPTIONS, or_JAVA_OPTIONSis set, the JVM prints notices such asPicked up JAVA_TOOL_OPTIONS: ...tostderr. Becausestderrwas merged intostdout, the notice was captured intoMAVEN_OPTS, causing the JVM to treatPicked(orNOTE:) as the main class name on launch.Solution
bin/mvnwhen executingJvmConfigParser.java.test-mvn-jvm-config.shto verify that JVM notices do not pollute JVM arguments and that parser errors are still reported.shell-script-testsprofile inapache-maven/pom.xml.