Details
Description
It's normal to use some space characters at file name or directory name these days,
But maven won't support it in the maven.bat script.
here is how to reproduce
—
0. Windows 2003 Server, run cmd.exe and enter follows
1. set JAVA_HOME=C:\Program Files\Java\JDK\
2. set MAVEN_HOME=C:\Some Directory Name That Has A Space Character\Maven\
3. set PATH=%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%PATH%
4. set MAVEN_BATCH_ECHO=on
5. maven.bat
and here is the generated error when I run with space containing MAVEN_HOME
—
C:\Documents and Settings\HeartBit>maven
C:\Documents and Settings\HeartBit>if exist "\mavenrc_pre.bat" call "\mavenrc_pr
e.bat"
C:\Documents and Settings\HeartBit>if "Windows_NT" == "Windows_NT"
C:\Documents and Settings\HeartBit>set MAVEN_COMMAND_COM="cmd.exe"
C:\Documents and Settings\HeartBit>if exist "C:\WINDOWS\system32\cmd.exe" set MA
VEN_COMMAND_COM="C:\WINDOWS\system32\cmd.exe"
C:\Documents and Settings\HeartBit>if exist "C:\WINDOWS\command.com" set MAVEN_C
OMMAND_COM="C:\WINDOWS\command.com"
C:\Documents and Settings\HeartBit>set MAVEN_FIND_EXE="find.exe"
C:\Documents and Settings\HeartBit>if exist "C:\WINDOWS\system32\find.exe" set M
AVEN_FIND_EXE="C:\WINDOWS\system32\find.exe"
C:\Documents and Settings\HeartBit>if exist "C:\WINDOWS\command\find.exe" set MA
VEN_FIND_EXE="C:\WINDOWS\command\find.exe"
C:\Documents and Settings\HeartBit>if not "C:\Progra~1\Java\j2re1.4.2" == "" got
o OkJHome
C:\Documents and Settings\HeartBit>"C:\WINDOWS\system32\cmd.exe" /C DIR "C:\Prog
ra~1\Java\j2re1.4.2" 2>&1 | "C:\WINDOWS\system32\find.exe" /I /C "C:\Progra~1
\Java\j2re1.4.2" 1>nul
C:\Documents and Settings\HeartBit>if not errorlevel 1 goto chkMHome
and was unexpected at this time.
C:\Documents and Settings\HeartBit>if not ""C:\Documents and Settings\HeartBit\M
y Documents\My Program Files\maven""=="" goto valMHome
C:\Documents and Settings\HeartBit>
My MAVEN_HOME has spaces in it and works ok. It's not MAVEN_HOME causing this.