Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions apache-maven/src/assembly/maven/bin/mvn
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,20 @@ cmd="\"$JAVACMD\" \

if [ -n "$MAVEN_DEBUG_SCRIPT" ]; then
echo "[DEBUG] Launching JVM with command:" >&2
printf '[DEBUG] %s' "$cmd" >&2; printf ' %s' "$MAVEN_ARGS" >&2; printf ' "%s"' "$@" >&2; echo >&2
printf '[DEBUG] %s' "$cmd" >&2
if [ "$MAVEN_MAIN_CLASS" = "org.apache.maven.cling.MavenCling" ]; then
printf ' %s' "$MAVEN_ARGS" >&2
fi
printf ' "%s"' "$@" >&2; echo >&2
fi

# 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' '"$@"'
# MAVEN_ARGS is only passed for the default Maven build command (MavenCling),
# not for sub-commands like --up, --enc, or --shell which have their own options.
if [ "$MAVEN_MAIN_CLASS" = "org.apache.maven.cling.MavenCling" ]; then
eval exec "$cmd" '$MAVEN_ARGS' '"$@"'
else
eval exec "$cmd" '"$@"'
fi
4 changes: 4 additions & 0 deletions apache-maven/src/assembly/maven/bin/mvn.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ for %%i in ("%MAVEN_HOME%"\boot\plexus-classworlds-*) do set LAUNCHER_JAR="%%i"
set LAUNCHER_CLASS=org.codehaus.plexus.classworlds.launcher.Launcher
if "%MAVEN_MAIN_CLASS%"=="" @set MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenCling

@REM Only pass MAVEN_ARGS for the default Maven build command (MavenCling),
@REM not for sub-commands like --up, --enc, or --shell which have their own options.
if not "%MAVEN_MAIN_CLASS%"=="org.apache.maven.cling.MavenCling" set "MAVEN_ARGS="

if defined MAVEN_DEBUG_SCRIPT (
echo [DEBUG] Launching JVM with command:
echo [DEBUG] "%JAVACMD%" %INTERNAL_MAVEN_OPTS% %MAVEN_OPTS% %JVM_CONFIG_MAVEN_OPTS% %MAVEN_DEBUG_OPTS% --enable-native-access=ALL-UNNAMED -classpath %LAUNCHER_JAR% "-Dclassworlds.conf=%CLASSWORLDS_CONF%" "-Dmaven.home=%MAVEN_HOME%" "-Dmaven.mainClass=%MAVEN_MAIN_CLASS%" "-Dlibrary.jline.path=%MAVEN_HOME%\lib\jline-native" "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %LAUNCHER_CLASS% %MAVEN_ARGS% %*
Expand Down
Loading