Skip to content

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Dec 10, 2025

Backport

This will backport the following commits from master to maven-4.0.x:

Questions ?

Please refer to the Backport tool documentation

…1485 and apache#11486) (apache#11365)

Replace shell-based jvm.config parsing with a Java-based parser to fix issues
with special characters (pipes, @, quotes) that cause shell command errors.

Problems fixed:
- MNG-11363: Pipe symbols (|) in jvm.config cause shell parsing errors
- apacheGH-11485: @ character in paths (common in Jenkins workspaces like
  project_PR-350@2) causes sed failures
- MNG-11486: POSIX compliance issues with xargs -0 on AIX, FreeBSD, etc.

Solution:
Add JvmConfigParser.java that runs via Java source-launch mode (JDK 11+) to
parse jvm.config files. This avoids all shell parsing complexities and works
consistently across Unix and Windows platforms.

Changes:
- Add apache-maven/bin/JvmConfigParser.java: Java parser that handles quoted
  arguments, comments, line continuations, and ${MAVEN_PROJECTBASEDIR}
  substitution
- Update mvn (Unix): Use JvmConfigParser instead of tr/sed/xargs pipeline
- Update mvn.cmd (Windows): Use JvmConfigParser with direct file output to
  avoid Windows file locking issues with shell redirection
- Add MAVEN_DEBUG_SCRIPT environment variable for debug logging in both
  scripts to aid troubleshooting
- Add integration tests for pipe symbols and @ character handling
- Improve Verifier to save stdout/stderr to separate files for debugging

The parser outputs arguments as quoted strings, preserving special characters
that would otherwise be interpreted by the shell.

(cherry picked from commit da5f27e)

# Conflicts:
#	its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/Verifier.java
@gnodet gnodet merged commit 6c191d0 into apache:maven-4.0.x Dec 11, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working mvn40

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant