[MNG-8650] Fix MAVEN_ARGS backslash stripping on Windows#12349
Open
gnodet wants to merge 1 commit into
Open
Conversation
Move $MAVEN_ARGS out of the eval'd cmd string so that eval
does not re-parse its value and strip backslashes. The variable
reference is now single-quoted ('$MAVEN_ARGS') on the eval line,
matching the existing treatment of "$@" from PR #11983.
Closes #11487
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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 #12348 to maven-4.0.x.
Fixes #11487
Summary
$MAVEN_ARGSout of theeval'dcmdstring in themvnlauncher script'$MAVEN_ARGS') on theevalline, soevalexpands it as a normal variable rather than re-parsing the already-expanded value — preserving backslashes"$@"in PR Fix mvn script expanding ${...} in CLI arguments #11983Root cause
eval exec "$cmd"re-parses the expanded string. When$MAVEN_ARGSwas embedded incmdat assignment time, its value became literal text in theeval'd string, causing backslashes (e.g. Windows paths likeC:\Users\...) to be interpreted as escape characters and stripped.Test plan
MAVEN_ARGS="-Dfoo=C:\path\to\file"and verify the property value reaches Maven with backslashes intactMAVEN_OPTSwith quoted values still works correctly (eval still handles those)MAVEN_ARGSwith multiple space-separated arguments still works🤖 Generated with Claude Code