This is an automated email from the ASF dual-hosted git repository.
slawekjaranowski pushed a commit to branch maven-3.10.x
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/maven-3.10.x by this push:
new a95c0160d5 Remove JLine/JAnsi native-access workarounds from launcher
scripts
a95c0160d5 is described below
commit a95c0160d52447d9a199b405386f16832faff0b3
Author: Slawomir Jaranowski <[email protected]>
AuthorDate: Mon Nov 9 18:46:50 2026 +0100
Remove JLine/JAnsi native-access workarounds from launcher scripts
Follow-up to #13888, which dropped JLine and JAnsi. Maven no longer
loads native code at startup, so the JVM flags added for those
libraries are no longer needed:
- MNG-8248: --enable-native-access=ALL-UNNAMED silenced the JDK 24+
"restricted method" warning caused by System::load calls in
JLineNativeLoader / JansiLoader.
- MNG-8169: --add-opens java.base/java.lang=ALL-UNNAMED was needed on
MINGW because Jansi 2.4.1 reflected into java.lang to detect the
pseudo-terminal.
This also saves one extra JVM start on every Maven invocation.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
apache-maven/src/bin/mvn | 9 ---------
apache-maven/src/bin/mvn.cmd | 11 -----------
2 files changed, 20 deletions(-)
diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
index aaa953b063..2a26a5380a 100755
--- a/apache-maven/src/bin/mvn
+++ b/apache-maven/src/bin/mvn
@@ -241,15 +241,6 @@ export MAVEN_PROJECTBASEDIR
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
-# MNG-8248
-if "$JAVACMD" --enable-native-access=ALL-UNNAMED -version >/dev/null 2>&1; then
- MAVEN_OPTS="--enable-native-access=ALL-UNNAMED $MAVEN_OPTS"
- # MNG-8169
- if $mingw ; then
- MAVEN_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED $MAVEN_OPTS"
- fi
-fi
-
# Parse MAVEN_ARGS: words are separated by white space, single or double
quotes group a
# word containing white space. Nothing else is interpreted (no backslash, no
${...},
# no globbing, no command substitution). The words go in front of the user
arguments.
diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
index ef30431307..a7706fdad8 100644
--- a/apache-maven/src/bin/mvn.cmd
+++ b/apache-maven/src/bin/mvn.cmd
@@ -33,10 +33,6 @@
@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
@@ -190,15 +186,8 @@ if "_%MAVEN_PROJECTBASEDIR:~-1%"=="_\" set
"MAVEN_PROJECTBASEDIR=%MAVEN_PROJECTB
for %%i in ("%MAVEN_HOME%"\boot\plexus-classworlds-*) do set
CLASSWORLDS_JAR="%%i"
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 "INTERNAL_MAVEN_OPTS=--enable-native-access=ALL-UNNAMED
%INTERNAL_MAVEN_OPTS%"
-:skipEnableNativeAccess
-
"%JAVACMD%" ^
%JVM_CONFIG_MAVEN_OPTS% ^
- %INTERNAL_MAVEN_OPTS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %CLASSWORLDS_JAR% ^