[ 
https://issues.apache.org/jira/browse/MNG-8315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francois MAROT updated MNG-8315:
--------------------------------
    Description: 
When .mvn is located on filesystem root, on Windows, the command line created 
(in mvn.cmd) to run java fails.
This is because the part concerning multiModuleProjectDirectory ends with a 
slash before the double quote which certainly means escaping and it messes the 
whole command. Example for drive o: :
{code:java}
"-Dmaven.multiModuleProjectDirectory=o:\"{code}
In this case, java.exe displays its usage help as it thinks the command is 
wrong.

The workaround is to add an additional escaping backslash:
{code:java}
"-Dmaven.multiModuleProjectDirectory=o:"{code}
Note: this only happens in case there is a .mvn at root.

 

This simple line added just before calling "%JAVACMD%" seems to do the job:
{code:java}
if "%MAVEN_PROJECTBASEDIR:~-1%"=="\" set 
"MAVEN_PROJECTBASEDIR=%MAVEN_PROJECTBASEDIR%\"{code}
A workaround for users facing the problem is to define MAVEN_BASEDIR to the 
drive root with 2 backslash before running Maven:
{code:java}
set MAVEN_BASEDIR=%tempDriveLetter%:\\{code}
 

 

  was:
When .mvn is located on filesystem root, on Windows, the command line created 
(in mvn.cmd) to run java fails.
This is because the part concerning multiModuleProjectDirectory ends with a 
slash before the double quote which certainly means escaping and it messes the 
whole command. Example for drive o: : "-Dmaven.multiModuleProjectDirectory=o:\"

In this case, java.exe displays its usage help as it thinks the command is 
wrong.

The workaround is to add an additional escaping backslash: 
"-Dmaven.multiModuleProjectDirectory=o:"

Note: this only happens in case there is a .mvn at root.

 

This simple line added just before calling "%JAVACMD%" seems to do the job:

if "{_}%MAVEN_PROJECTBASEDIR:~-1%"=="{_}\" set 
"MAVEN_PROJECTBASEDIR=%MAVEN_PROJECTBASEDIR%\"

 

 


> Failure of mvn.cmd if a .mvn directory is located at drive root
> ---------------------------------------------------------------
>
>                 Key: MNG-8315
>                 URL: https://issues.apache.org/jira/browse/MNG-8315
>             Project: Maven
>          Issue Type: Bug
>          Components: Command Line
>    Affects Versions: 3.9.9
>         Environment: Windows 10
>            Reporter: Francois MAROT
>            Priority: Minor
>              Labels: easyfix
>
> When .mvn is located on filesystem root, on Windows, the command line created 
> (in mvn.cmd) to run java fails.
> This is because the part concerning multiModuleProjectDirectory ends with a 
> slash before the double quote which certainly means escaping and it messes 
> the whole command. Example for drive o: :
> {code:java}
> "-Dmaven.multiModuleProjectDirectory=o:\"{code}
> In this case, java.exe displays its usage help as it thinks the command is 
> wrong.
> The workaround is to add an additional escaping backslash:
> {code:java}
> "-Dmaven.multiModuleProjectDirectory=o:"{code}
> Note: this only happens in case there is a .mvn at root.
>  
> This simple line added just before calling "%JAVACMD%" seems to do the job:
> {code:java}
> if "%MAVEN_PROJECTBASEDIR:~-1%"=="\" set 
> "MAVEN_PROJECTBASEDIR=%MAVEN_PROJECTBASEDIR%\"{code}
> A workaround for users facing the problem is to define MAVEN_BASEDIR to the 
> drive root with 2 backslash before running Maven:
> {code:java}
> set MAVEN_BASEDIR=%tempDriveLetter%:\\{code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to