2

In the Maven Windows prerequisites, it states,

You need to unpack the Maven distribution. Don't unpack it in the middle of your source code; pick some location (with no spaces in the path!) and unpack it there.

Why does it matter if there are spaces in the path or not?

jumpnett
  • 6,967
  • 1
  • 19
  • 24
  • Because this is still a problem. It will not work. You'll geet errors like [this](http://stackoverflow.com/questions/13288735/maven-not-picking-java-home-correctly) – ppeterka Sep 10 '13 at 16:25
  • @ppeterka66 Meaning what exactly? I assume it's a problem, otherwise they wouldn't advise against it. I want to know what the problem is. – jumpnett Sep 10 '13 at 16:27
  • This part of maven has bugs that treat the spaces in the path as if there is a 2nd parameter. Just run the words together and capitalize the first letter of each new word. I made a new folder in the root of C: named 'ProgramFiles' that I use for this sort of program. – Lee Meador Sep 10 '13 at 16:29
  • 3
    Most such programs will allow you to use "PROGRA~1" or some such name in place of "Program Files" as Windows will allow use of short names for files and folders. Use `dir /X` to show the short names under Windows. – Lee Meador Sep 10 '13 at 16:31
  • @LeeMeador thanks for pointing out the alternative, it works! – 01000001 Aug 28 '23 at 17:20

1 Answers1

7

The problem is that somewhere in Maven, it is executing a sub process and it is not properly wrapping its file name arguments in double quotes. So a file that is at

"C:\Program Files\Foobar"

will look like 2 files on the command line

"C:\Program"
"Files\Foobar"

and neither of those are correct. This is a holdover from the "old" days when spaces were not allowed in file names (ie 1980s) and spaces separated arguments on the command line. It's a shame that this problem still exists. It's slightly worse on Linux machines, which have been slower to migrate to allowing spaces in file names, so there are more scripts and programs on Linux which fail if you have spaces in the file names.

Mark Lakata
  • 19,989
  • 5
  • 106
  • 123