[ 
https://issues.apache.org/jira/browse/MNG-6385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16419476#comment-16419476
 ] 

Gili edited comment on MNG-6385 at 3/29/18 5:50 PM:
----------------------------------------------------

Here is the output with {{MAVEN_BATCH_ECHO=on}}:

{code}
cd C:\Users\Gili\Documents\pyramid\server; "JAVA_HOME=C:\\Program 
Files\\Java\\jdk1.8.0_161" "M2_HOME=C:\\Program Files\\apache-maven-3.5.2" cmd 
/c "\"\"C:\\Program Files\\apache-maven-3.5.2\\bin\\mvn.cmd\" 
-Dexec.args=\"-agentpath:\\\"C:/Program 
Files/netbeans-245/profiler/lib/deployed/jdk16/windows-amd64/profilerinterface.dll\\\"=\\\"C:\\Program
 Files\\netbeans-245\\profiler\\lib\\\",5140,10 -XX:+HeapDumpOnOutOfMemoryError 
-XX:HeapDumpPath=C:\\Users\\Gili\\AppData\\Local\\NetBeans\\Cache\\dev\\mavencachedirs\\354137174\\org-netbeans-modules-profiler
  -ea -classpath %classpath com.holdmyspot.pyramid.server.ArbitrageBot\" 
-Dexec.executable=\"C:\\Program Files\\Java\\jdk1.8.0_161\\bin\\java.exe\" 
-Dexec.workingdir=C:\\Users\\Gili\\Documents\\Pyramid\\server\\target 
-Dmaven.ext.class.path=\"C:\\Program 
Files\\netbeans-245\\java\\maven-nblib\\netbeans-eventspy.jar\" 
-Dfile.encoding=UTF-8 process-classes 
org.codehaus.mojo:exec-maven-plugin:1.5.0:exec\""

C:\Users\Gili\Documents\pyramid\server>if not "" == "" goto skipRcPre 

C:\Users\Gili\Documents\pyramid\server>if exist "C:\Users\Gili\mavenrc_pre.bat" 
call "C:\Users\Gili\mavenrc_pre.bat" 

C:\Users\Gili\Documents\pyramid\server>if exist "C:\Users\Gili\mavenrc_pre.cmd" 
call "C:\Users\Gili\mavenrc_pre.cmd" 

C:\Users\Gili\Documents\pyramid\server>set ERROR_CODE=0 

C:\Users\Gili\Documents\pyramid\server>if not "C:\Program 
Files\Java\jdk1.8.0_161" == "" goto OkJHome 

C:\Users\Gili\Documents\pyramid\server>set "JAVACMD=C:\Program 
Files\Java\jdk1.8.0_161\bin\java.exe" 

C:\Users\Gili\Documents\pyramid\server>if exist "C:\Program 
Files\Java\jdk1.8.0_161\bin\java.exe" goto chkMHome 

C:\Users\Gili\Documents\pyramid\server>set "MAVEN_HOME=C:\Program 
Files\apache-maven-3.5.2\bin\.." 

C:\Users\Gili\Documents\pyramid\server>if not "C:\Program 
Files\apache-maven-3.5.2\bin\.." == "" goto valMHome 

C:\Users\Gili\Documents\pyramid\server>if not "_." == "_\" goto checkMCmd 

C:\Users\Gili\Documents\pyramid\server>if exist "C:\Program 
Files\apache-maven-3.5.2\bin\..\bin\mvn.cmd" goto init 

C:\Users\Gili\Documents\pyramid\server>set 
MAVEN_CMD_LINE_ARGS=-Dexec.args="-agentpath:\"C:/Program 
Files/netbeans-245/profiler/lib/deployed/jdk16/windows-amd64/profilerinterface.dll\"=\"C:\Program
 Files\netbeans-245\profiler\lib\",5140,10 -XX:+HeapDumpOnOutOfMemoryError 
-XX:HeapDumpPath=C:\Users\Gili\AppData\Local\NetBeans\Cache\dev\mavencachedirs\354137174\org-netbeans-modules-profiler
  -ea -classpath %classpath com.holdmyspot.pyramid.server.ArbitrageBot" 
-Dexec.executable="C:\Program Files\Java\jdk1.8.0_161\bin\java.exe" 
-Dexec.workingdir=C:\Users\Gili\Documents\Pyramid\server\target 
-Dmaven.ext.class.path="C:\Program 
Files\netbeans-245\java\maven-nblib\netbeans-eventspy.jar" 
-Dfile.encoding=UTF-8 process-classes 
org.codehaus.mojo:exec-maven-plugin:1.5.0:exec 

C:\Users\Gili\Documents\pyramid\server>set "MAVEN_PROJECTBASEDIR=" 

C:\Users\Gili\Documents\pyramid\server>if not "" == "" goto endDetectBaseDir 

C:\Users\Gili\Documents\pyramid\server>set 
"EXEC_DIR=C:\Users\Gili\Documents\pyramid\server" 

C:\Users\Gili\Documents\pyramid\server>set 
"WDIR=C:\Users\Gili\Documents\pyramid\server" 

C:\Users\Gili\Documents\pyramid\server>set FILE_ARG= 

C:\Users\Gili\Documents\pyramid\server>if "-Dexec.args" == "-f" (
set "FILE_ARG=-agentpath:\"C:/Program"  
 shift 
 goto process_file_arg 
) 

C:\Users\Gili\Documents\pyramid\server>if "-Dexec.args" == "--file" (
set "FILE_ARG=-agentpath:\"C:/Program"  
 shift 
 goto process_file_arg 
) 

C:\Users\Gili\Documents\pyramid\server>shift
The syntax of the command is incorrect.

C:\Users\Gili\Documents\pyramid\server>if not "-agentpath:\"C:/Program" == "" (
{code}

{{%~2}} definitely doesn't like the spaces. It's not clear to me whether 
Netbeans' command-line is wrong here or {{mvn.cmd}}. I also find it odd that 
{{shift}} is failing.


was (Author: cowwoc):
Here is the output with `MAVEN_BATCH_ECHO=on`:

{code}
cd C:\Users\Gili\Documents\pyramid\server; "JAVA_HOME=C:\\Program 
Files\\Java\\jdk1.8.0_161" "M2_HOME=C:\\Program Files\\apache-maven-3.5.2" cmd 
/c "\"\"C:\\Program Files\\apache-maven-3.5.2\\bin\\mvn.cmd\" 
-Dexec.args=\"-agentpath:\\\"C:/Program 
Files/netbeans-245/profiler/lib/deployed/jdk16/windows-amd64/profilerinterface.dll\\\"=\\\"C:\\Program
 Files\\netbeans-245\\profiler\\lib\\\",5140,10 -XX:+HeapDumpOnOutOfMemoryError 
-XX:HeapDumpPath=C:\\Users\\Gili\\AppData\\Local\\NetBeans\\Cache\\dev\\mavencachedirs\\354137174\\org-netbeans-modules-profiler
  -ea -classpath %classpath com.holdmyspot.pyramid.server.ArbitrageBot\" 
-Dexec.executable=\"C:\\Program Files\\Java\\jdk1.8.0_161\\bin\\java.exe\" 
-Dexec.workingdir=C:\\Users\\Gili\\Documents\\Pyramid\\server\\target 
-Dmaven.ext.class.path=\"C:\\Program 
Files\\netbeans-245\\java\\maven-nblib\\netbeans-eventspy.jar\" 
-Dfile.encoding=UTF-8 process-classes 
org.codehaus.mojo:exec-maven-plugin:1.5.0:exec\""

C:\Users\Gili\Documents\pyramid\server>if not "" == "" goto skipRcPre 

C:\Users\Gili\Documents\pyramid\server>if exist "C:\Users\Gili\mavenrc_pre.bat" 
call "C:\Users\Gili\mavenrc_pre.bat" 

C:\Users\Gili\Documents\pyramid\server>if exist "C:\Users\Gili\mavenrc_pre.cmd" 
call "C:\Users\Gili\mavenrc_pre.cmd" 

C:\Users\Gili\Documents\pyramid\server>set ERROR_CODE=0 

C:\Users\Gili\Documents\pyramid\server>if not "C:\Program 
Files\Java\jdk1.8.0_161" == "" goto OkJHome 

C:\Users\Gili\Documents\pyramid\server>set "JAVACMD=C:\Program 
Files\Java\jdk1.8.0_161\bin\java.exe" 

C:\Users\Gili\Documents\pyramid\server>if exist "C:\Program 
Files\Java\jdk1.8.0_161\bin\java.exe" goto chkMHome 

C:\Users\Gili\Documents\pyramid\server>set "MAVEN_HOME=C:\Program 
Files\apache-maven-3.5.2\bin\.." 

C:\Users\Gili\Documents\pyramid\server>if not "C:\Program 
Files\apache-maven-3.5.2\bin\.." == "" goto valMHome 

C:\Users\Gili\Documents\pyramid\server>if not "_." == "_\" goto checkMCmd 

C:\Users\Gili\Documents\pyramid\server>if exist "C:\Program 
Files\apache-maven-3.5.2\bin\..\bin\mvn.cmd" goto init 

C:\Users\Gili\Documents\pyramid\server>set 
MAVEN_CMD_LINE_ARGS=-Dexec.args="-agentpath:\"C:/Program 
Files/netbeans-245/profiler/lib/deployed/jdk16/windows-amd64/profilerinterface.dll\"=\"C:\Program
 Files\netbeans-245\profiler\lib\",5140,10 -XX:+HeapDumpOnOutOfMemoryError 
-XX:HeapDumpPath=C:\Users\Gili\AppData\Local\NetBeans\Cache\dev\mavencachedirs\354137174\org-netbeans-modules-profiler
  -ea -classpath %classpath com.holdmyspot.pyramid.server.ArbitrageBot" 
-Dexec.executable="C:\Program Files\Java\jdk1.8.0_161\bin\java.exe" 
-Dexec.workingdir=C:\Users\Gili\Documents\Pyramid\server\target 
-Dmaven.ext.class.path="C:\Program 
Files\netbeans-245\java\maven-nblib\netbeans-eventspy.jar" 
-Dfile.encoding=UTF-8 process-classes 
org.codehaus.mojo:exec-maven-plugin:1.5.0:exec 

C:\Users\Gili\Documents\pyramid\server>set "MAVEN_PROJECTBASEDIR=" 

C:\Users\Gili\Documents\pyramid\server>if not "" == "" goto endDetectBaseDir 

C:\Users\Gili\Documents\pyramid\server>set 
"EXEC_DIR=C:\Users\Gili\Documents\pyramid\server" 

C:\Users\Gili\Documents\pyramid\server>set 
"WDIR=C:\Users\Gili\Documents\pyramid\server" 

C:\Users\Gili\Documents\pyramid\server>set FILE_ARG= 

C:\Users\Gili\Documents\pyramid\server>if "-Dexec.args" == "-f" (
set "FILE_ARG=-agentpath:\"C:/Program"  
 shift 
 goto process_file_arg 
) 

C:\Users\Gili\Documents\pyramid\server>if "-Dexec.args" == "--file" (
set "FILE_ARG=-agentpath:\"C:/Program"  
 shift 
 goto process_file_arg 
) 

C:\Users\Gili\Documents\pyramid\server>shift
The syntax of the command is incorrect.

C:\Users\Gili\Documents\pyramid\server>if not "-agentpath:\"C:/Program" == "" (
{code}

`%~2` definitely doesn't like the spaces. It's not clear to me whether 
Netbeans' command-line is wrong here or `mvn.cmd`. I also find it odd that 
`shift` is failing.

> Windows mvn.cmd fail with incorrect command syntax.
> ---------------------------------------------------
>
>                 Key: MNG-6385
>                 URL: https://issues.apache.org/jira/browse/MNG-6385
>             Project: Maven
>          Issue Type: Bug
>          Components: Command Line
>    Affects Versions: 3.5.0, 3.5.2, 3.5.3
>            Reporter: Eric Barboni
>            Priority: Major
>
> Hi, during some test using Apache Netbeans on windows it appears that some 
> cli can lead to failure of executing mvn.cmd
> It was working before on 3.3.9 version.
> In the code example (below) if space are removed from path in agentpath 
> section it works.
> Otherwise the arguments are cut during evaluation
> and the following syntax incorrect will happen
> if not "-agentpath:\"E:\opensource\space" == "" (
> Best Regards
> {code}
> e:\outils\apache-maven-3.5.3\bin\mvn 
> -Dexec.args="-agentpath:\"E:\opensource\space 
> netbeans\netbeans\profiler\lib\deployed\jdk16\windows-amd64\profilerinterface.dll\"=\"E:\opensource\space
>  netbeans\netbeans\profiler\lib\",5140,10 -XX:+HeapDumpOnOutOfMemoryError 
> -XX:HeapDumpPath=C:\Users\barboni\AppData\Local\NetBeans\Cache\dev\mavencachedirs\2080072884\org-netbeans-modules-profiler
>   -classpath %classpath com.mycompany.mavenproject23.newClass"  
> -Dexec.executable="C:\Program Files\Java\jdk1.8.0_162\bin\java.exe" 
> -Dexec.classpathScope=runtime -DskipTests=true 
> -Dmaven.ext.class.path="E:\opensource\space 
> netbeans\netbeans\java\maven-nblib\netbeans-eventspy.jar" 
> -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:1.5.0:exec
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to