diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd index 972c39eaf26c..affbe4318216 100644 --- a/apache-maven/src/bin/mvn.cmd +++ b/apache-maven/src/bin/mvn.cmd @@ -33,6 +33,10 @@ @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' @if "%MAVEN_BATCH_ECHO%"=="on" echo %MAVEN_BATCH_ECHO% +@REM Clear/define a variable for any options to be inserted via script +@REM We want to avoid trying to parse the external MAVEN_OPTS variable +SET INTERNAL_MAVEN_OPTS= + @REM Execute a user defined script before this one if not "%MAVEN_SKIP_RC%"=="" goto skipRcPre @REM check for pre script, once with legacy .bat ending and once with .cmd ending @@ -175,11 +179,12 @@ set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher @REM MNG-8248 "%JAVACMD%" --enable-native-access=ALL-UNNAMED -version >nul 2>&1 if ERRORLEVEL 1 goto skipEnableNativeAccess -set "MAVEN_OPTS=--enable-native-access=ALL-UNNAMED %MAVEN_OPTS%" +set "INTERNAL_MAVEN_OPTS=--enable-native-access=ALL-UNNAMED %INTERNAL_MAVEN_OPTS%" :skipEnableNativeAccess "%JAVACMD%" ^ %JVM_CONFIG_MAVEN_PROPS% ^ + %INTERNAL_MAVEN_OPTS% ^ %MAVEN_OPTS% ^ %MAVEN_DEBUG_OPTS% ^ -classpath %CLASSWORLDS_JAR% ^