Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 2.0.2
-
Fix Version/s: None
-
Component/s: Command Line
-
Labels:None
-
Environment:Darwin
-
Complexity:Intermediate
Description
Even if I properly escape spaces in a path at the shell level, Maven seems to re-split the command parameters. For instance, on Unix, the following should all run the compile goal with a property foo="bar baz":
$ mvn compile "-Dfoo=bar baz"
$ mvn compile -Dfoo="bar baz"
$ mvn compile -Dfoo=bar\ baz
But in fact, Maven fails, complaining that "baz" is an invalid task:
[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ----------------------------------------------------------------------------
[INFO] Invalid task 'baz': you must specify a valid lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal
[INFO] ----------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ----------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Mar 29 15:21:01 EST 2006
[INFO] Final Memory: 1M/2M
[INFO] ----------------------------------------------------------------------------
Is this intended behavior? Seems as if Maven is unnecessarily splitting the string, when the OS already does as much.
I was merely trying to run:
mvn deploy:deploy-file "-Dfile=/Users/me/Desktop/Bellicose SDK/lib/Bellicose.jar" ...
In my case, it's practical to work around by renaming the Bellicose SDK folder, but it seems as if Windows users stuck with "C:\Documents and Settings\..." might have a harder time of it.
Issue Links
- duplicates
-
MNG-1415
quoted arguments are not being protected
-
- is duplicated by
-
MRELEASE-436
Spaces in scmCommitPrefix cause errors in attempting to release
-
- relates to
-
MNG-3529
mvn -Da=" " throws an excepltion
-
Reopening with patch to use "$@" rather than trying to second-guess argv.
The current status quo fails on args like '-Dfoo=my "great" new project'. This is not a valid path on Windows, so I don't think I can adapt the integration test to suit. Probably could test on a property used for some other purpose, though.
It's probably true that not all shells support "$@", but I would be very surprised if anything installed at /bin/sh doesn't. Notably, ant's wrapper script uses "$@", so if that's "portable enough," then this patch should also be.
All integration tests do pass.