Skip to content

Commit e2eddae

Browse files
committed
[gh-11363] Use Java single-file source execution instead of compiling
Use 'java SourceFile.java' (Java 11+) to run the parser directly without compilation. This avoids needing write access to the bin directory and simplifies the script.
1 parent 7863521 commit e2eddae

File tree

1 file changed

+2
-6
lines changed
  • apache-maven/src/assembly/maven/bin

1 file changed

+2
-6
lines changed

apache-maven/src/assembly/maven/bin/mvn.cmd

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,9 @@ if not exist "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadJvmConfig
181181

182182
rem Use Java to parse jvm.config to avoid batch script parsing issues with special characters
183183
rem This handles pipes, quotes, and other special characters correctly
184-
rem Compile the parser if not already compiled
185-
if not exist "%MAVEN_HOME%\bin\JvmConfigParser.class" (
186-
"%JAVACMD:java.exe=javac.exe%" -d "%MAVEN_HOME%\bin" "%MAVEN_HOME%\bin\JvmConfigParser.java" >nul 2>&1
187-
)
188-
rem Run the parser and save output to temp file (single line with quoted arguments)
184+
rem Use single-file source-code execution (Java 11+) to avoid needing write access to bin directory
189185
set "JVM_CONFIG_TEMP=%TEMP%\mvn-jvm-config-%RANDOM%.txt"
190-
"%JAVACMD%" -cp "%MAVEN_HOME%\bin" JvmConfigParser "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" "%MAVEN_PROJECTBASEDIR%" > "%JVM_CONFIG_TEMP%" 2>nul
186+
"%JAVACMD%" "%MAVEN_HOME%\bin\JvmConfigParser.java" "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" "%MAVEN_PROJECTBASEDIR%" > "%JVM_CONFIG_TEMP%" 2>nul
191187
rem Read the single line from temp file
192188
set /p JVM_CONFIG_MAVEN_OPTS=<"%JVM_CONFIG_TEMP%"
193189
del "%JVM_CONFIG_TEMP%" 2>nul

0 commit comments

Comments
 (0)