Visitar URL original
Fix MAVEN_ARGS parsing to handle quoted strings with spaces by gnodet · Pull Request #11824 · apache/maven · GitHub
Skip to content

Fix MAVEN_ARGS parsing to handle quoted strings with spaces - #11824

Closed
gnodet wants to merge 1 commit into
masterfrom
fix/maven-args-parsing
Closed

gnodet wants to merge 1 commit into
masterfrom
fix/maven-args-parsing

Conversation

@gnodet

@gnodet gnodet commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace naive String.split(" ") with a proper argument parser that handles single and double quoted strings, preserving backslashes for Windows paths
  • Applied to both EmbeddedMavenExecutor and ForkedMavenExecutor
  • Added unit tests for both executors covering simple args, quoted paths, empty input, and extra whitespace

Fixes #11487

Test plan

  • Unit tests for parseArguments() method in both executor implementations
  • Manual test with MAVEN_ARGS='-f "C:\Program Files\project\pom.xml"' on Windows

🤖 Generated with Claude Code

Replace naive String.split(" ") with a proper argument parser that
handles single and double quoted strings, preserving backslashes
for Windows paths. This fixes MAVEN_ARGS values like:
  -f "C:\Program Files\project\pom.xml"

Applied to both EmbeddedMavenExecutor and ForkedMavenExecutor.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet

gnodet commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Closing — the parseArguments() fix with proper quote handling is already on master, incorporated during the executor refactoring in #11976 / #12004.

Claude Code on behalf of Guillaume Nodet

@gnodet gnodet closed this Jun 1, 2026
@eugenesvk

Copy link
Copy Markdown

How did it fix when the manual test still fails? (though tried on a Mac, not Windows)
No spaces work
$MAVEN_ARGS=R'-s /Users/user/config/settings.xml -v'; mvn

Apache Maven 4.0.0-rc-7 (6d8f301)

This fails
$MAVEN_ARGS=R'-s "/Users/user/config space/settings.xml" -v'; mvn (this is a Raw string, so the env var is -s "/Users/user/config space/settings.xml" -v, which adds a single double-quoted space-separated path
with

The specified user settings file does not exist: /Users/user/config space/settings.xml" -v

The opening quote seems to be parsed, but the closing quote isn't treated as the end of path

@gnodet
gnodet deleted the fix/maven-args-parsing branch October 15, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[regression] Maven4 unable to pass settings path on Windows

2 participants