Skip to content
Merged
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
7 changes: 6 additions & 1 deletion apache-maven/src/bin/mvn.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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%"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should expose this new variable. Which means we need to set it to an empty string before trying the line 176, so that a value coming from the user env would not interfere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I've pushed a change to clear this variable at the top of the script.

:skipEnableNativeAccess

"%JAVACMD%" ^
%JVM_CONFIG_MAVEN_PROPS% ^
%INTERNAL_MAVEN_OPTS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %CLASSWORLDS_JAR% ^
Expand Down
Loading