GeezerVison is showing github.com — [MSHARED-832] Cannot invoke maven from path with parentheses on Windows · Issue #286 · apache/maven-shared-utils
[MSHARED-832] Cannot invoke maven from path with parentheses on Windows #286
Labels
bugSomething isn't workingduplicateThis issue or pull request already exists Description
Anton Krylov opened MSHARED-832 and commented
When M2_HOME is set to a path with parentheses (in this case C:\work\lol(1)\maven), the following command is generated on windows:
cmd.exe /X /C "C:\work\lol(1)\maven\bin\mvn.cmd -B -e -V compile"
This command fails, saying that C:\work\lol is not a known command
When a space is added to the path, the path gets escaped, and the command runs successfully.
It looks like more characters need to be escaped on some platforms
Affects: maven-invoker-2.2
Issue Links:
1 votes, 4 watchers
Activity
jira-importer commented on Feb 3, 2021
jira-importer commented on Sep 27, 2023
Elliotte Rusty Harold commented
Problem is likely in Shell.quoteOneItem and can be tested from Shell.getCommandLine which returns quoted arguments
jira-importer commented on Sep 27, 2023
Elliotte Rusty Harold commented
I can't immediately put my finger on any reference that explains which characters need to be escaped on Windows command lines and why. Anyone have that handy?
jira-importer commented on Jun 17, 2025
Matthias Bünger commented
This project has moved from Jira to GitHub Issues. This issue was migrated to apache/maven-invoker#127. Please visit the GitHub issue to view further activity, add comments, or subscribe to receive notifications.
slachiewicz commented on Sep 11, 2026
Closing as a duplicate of #268. Both come from the same place: Shell.quoteOneItem returns its input unchanged and the only quoting trigger is a space, so cmd.exe special characters such as & and ( reach the command line unquoted. The fix belongs in this repo, not in apache/maven-invoker#127 or apache/maven-jarsigner#47, which this comment cross-links so those trackers point back here.
This comment was created with AI assistance.
Metadata
Metadata
bugSomething isn't workingduplicateThis issue or pull request already exists Development
No branches or pull requestsIssue actions