You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[gh-11363] Fix pipe symbol handling in jvm.config on Windows
Use double nested for loops with eol=# and tokens=1 delims=# to handle comments,
then use delayed expansion only for MAVEN_PROJECTBASEDIR substitution.
The key insight from Maven 3 is that using %%a/%%b directly (parse-time expansion)
works with pipes. We can safely store %%b in a variable for substitution because
the parse-time expansion happens before the set command executes, storing pipes
as literal characters.
Solution: Double nested for loops + safe delayed expansion
- Outer loop: eol=# skips full-line comments, tokens=1 delims=# extracts part before #
- Inner loop: tokens=* trims spaces and skips empty lines
- Store %%b in variable for MAVEN_PROJECTBASEDIR substitution (safe because %%b is parse-time)
- Both loops use parse-time expansion (%%a, %%b), avoiding pipe interpretation
This approach:
- Handles full-line comments (lines starting with #) via eol=#
- Handles end-of-line comments (everything after #) via delims=#
- Trims leading/trailing whitespace via tokens=*
- Replaces ${MAVEN_PROJECTBASEDIR} and $MAVEN_PROJECTBASEDIR placeholders
- Skips empty lines automatically
- Handles pipe symbols correctly (not interpreted as command separators)
- Is simple and maintainable (21 lines)
0 commit comments