This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new 71c41f9270 [MNG-8650] Fix MAVEN_ARGS backslash stripping on Windows 
(#12348)
71c41f9270 is described below

commit 71c41f9270920d6f68583ab9285b267d5bc850fb
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Jun 25 15:17:25 2026 +0200

    [MNG-8650] Fix MAVEN_ARGS backslash stripping on Windows (#12348)
    
    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 <[email protected]>
---
 apache-maven/src/assembly/maven/bin/mvn | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/apache-maven/src/assembly/maven/bin/mvn 
b/apache-maven/src/assembly/maven/bin/mvn
index 04b149010b..85a9a98805 100755
--- a/apache-maven/src/assembly/maven/bin/mvn
+++ b/apache-maven/src/assembly/maven/bin/mvn
@@ -286,15 +286,14 @@ cmd="\"$JAVACMD\" \
   \"-Dmaven.mainClass=$MAVEN_MAIN_CLASS\" \
   \"-Dlibrary.jline.path=${MAVEN_HOME}/lib/jline-native\" \
   \"-Dmaven.multiModuleProjectDirectory=$MAVEN_PROJECTBASEDIR\" \
-  $LAUNCHER_CLASS \
-  $MAVEN_ARGS"
+  $LAUNCHER_CLASS"
 
 if [ -n "$MAVEN_DEBUG_SCRIPT" ]; then
   echo "[DEBUG] Launching JVM with command:" >&2
-  printf '[DEBUG]   %s' "$cmd" >&2; printf ' "%s"' "$@" >&2; echo >&2
+  printf '[DEBUG]   %s' "$cmd" >&2; printf ' %s' "$MAVEN_ARGS" >&2; printf ' 
"%s"' "$@" >&2; echo >&2
 fi
 
-# User arguments ("$@") are passed directly to preserve literal values
-# like ${...} Maven property placeholders without shell expansion.
-# Only the base command uses eval for MAVEN_OPTS word splitting.
-eval exec "$cmd" '"$@"'
+# User arguments ("$@") and MAVEN_ARGS are passed outside the eval'd string
+# to preserve literal values (backslashes, ${...} placeholders) without
+# shell re-parsing. Only the base command uses eval for MAVEN_OPTS word 
splitting.
+eval exec "$cmd" '$MAVEN_ARGS' '"$@"'

Reply via email to