This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 141329 [details] maven output Hi, I have a custom installation of Maven (3.0.5) provided by my enterprise on Windows 7 64 bits. The installation used to work well with Netbeans 7.3 but it fails with 7.4. Find in attachment the log when I run a clean install with Netbeans 7.4. The issue comes from the fact that our maven command use to add other options at the end of the line and Netbeans 7.4 surrounds the command line by double quotes : cmd /c "\"\"E:\\projects\\maven\\mvn3\\bin\\mvn.bat\" -Dmaven.ext.class.path=E:\\projects\\netbeans\\7.4\\java\\maven-nblib\\netbeans-eventspy.jar clean install\"\"" Thus the command line generated by ou custom maven is : "E:\projects\jboss\jdk\64\1.6.0_31\bin\java.exe" -Dproject.license=LO -classpath "E:\projects\maven\mvn3\bin\..\boot\plexus-classworlds-2.4.jar" "-Dclassworlds.conf=E:\projects\maven\mvn3\bin\..\bin\m2.conf" "-Dmaven.home=E:\projects\maven\mvn3\bin\.." org.codehaus.plexus.classworlds.launcher.Launcher -Dmaven.ext.class.path=E:\projects\netbeans\7.4\java\maven-nblib\netbeans-eventspy.jar clean install" -Dhttp.nonProxyHosts=maven -Pjrebel With the previous version 7.3 it was the command line was not surrounded by double quotes. I don't think there is a need to surround the whole command line with double quotes : an alternative could be to surround only path that may contain white space : cmd /c "\"E:\\projects\\maven\\mvn3\\bin\\mvn.bat\" \"-Dmaven.ext.class.path=E:\\projects\\netbeans\\7.4\\java\\maven-nblib\\netbeans-eventspy.jar\" clean install" Best regards.
your maven installation is doing non-standard things in mvn.bat? isn't MAVEN_OPTS supposed to do that? or .m2/settings.xml? The reason why we now run cmd /c on windows is that since 1.7_u21, the execution we used to have before is no longer executing in java and an error is thrown. see issue 228901
I've ran the script with @echo on and add debug option. First the command line receive by the script is (%CmdCmdLine%) : "cmd" /c ""E:\projects\maven\mvn3\bin\mvn.bat" -Dmaven.ext.class.path=E:\projects\netbeans\7.4\java\maven-nblib\netbeans-eventspy.jar clean install"" First it seems to have an extra double quote. Then when the script takes the parameters with %* it gets : -Dmaven.ext.class.path=E:\projects\netbeans\7.4\java\maven-nblib\netbeans-eventspy.jar clean install" I think a double quote is missing before the -Dmaven.ext.class.path option, don't you ?
(In reply to moghrabi from comment #2) > I've ran the script with @echo on and add debug option. > > First the command line receive by the script is (%CmdCmdLine%) : > "cmd" /c ""E:\projects\maven\mvn3\bin\mvn.bat" > -Dmaven.ext.class.path=E:\projects\netbeans\7.4\java\maven-nblib\netbeans- > eventspy.jar clean install"" > > First it seems to have an extra double quote. > > Then when the script takes the parameters with %* it gets : > -Dmaven.ext.class.path=E:\projects\netbeans\7.4\java\maven-nblib\netbeans- > eventspy.jar clean install" > > > I think a double quote is missing before the -Dmaven.ext.class.path option, > don't you ? each of the parameters needs to be quoted separately if it contains a space. eg. -Dmaven.ext.class.path=E:\projects\netbeans\7.4\java\maven-nblib\netbeans-eventspy.jar doesn't need quoting but -Dmaven.ext.class.path=E:\projects\netbeans 7.4\java\maven-nblib\netbeans-eventspy.jar would.. Same with any other -D parameter passed in. So quoting all parameters makes no sense, there's no way to figure out where the space means "new parameter" and when it's just part of the parameter's value.
I don't want you to quote each parameter. I'd like just to inform you that the command line caught by the %CmdCmdLine% variable contains an extra quote : "cmd" /c ""E:\projects\maven\mvn3\bin\mvn.bat" -Dmaven.ext.class.path=E:\projects\netbeans\7.4\java\maven-nblib\netbeans-eventspy.jar clean install"" If you count the quotes there are 7 quotes and the number must be even.
(In reply to moghrabi from comment #4) > I don't want you to quote each parameter. > unfortunately that's something I have to do. > I'd like just to inform you that the command line caught by the %CmdCmdLine% > variable contains an extra quote : > "cmd" /c ""E:\projects\maven\mvn3\bin\mvn.bat" The command line has to start with doubled quotes and end with doubled quotes. Then if the bat file path contains space, it has to be quoted as well, I recall that doing """E:\projets with space\mvn.bat" didn't however work and for some reason ""E:\projets with space\mvn.bat" did. > -Dmaven.ext.class.path=E:\projects\netbeans\7.4\java\maven-nblib\netbeans- > eventspy.jar clean install"" > > If you count the quotes there are 7 quotes and the number must be even. I'm not claiming the way it works now is perfect or correct, however it did work for the tested scenarios with maven and/or netbeans in path with spaces and parameters with spaces etc. Can you attach your changes done to the mvn.bat file? Once I'm on windows, I'll take a look.
Created attachment 141338 [details] Custom mvn.bat
Regarding the cumstom mvn.bat : Line 37, added : setlocal Line 42, replace : if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") by : set HOME=%~dp0 REM OLD WAY: => if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") if "%JDK_SET%" == "" SET JAVA_HOME=%HOME%..\jdk\32bits\jdk150_12 if not "%FORGE_HOME%"=="" set JAVA_HOME=E:\projects\jboss\jdk\64\1.6.0_31 Line 124, replace : set MAVEN_CMD_LINE_ARGS=%* by : set MAVEN_CMD_LINE_ARGS=%* %CUSTOM_CMD_LINE_ARGS% The variable CUSTOM_CMD_LINE_ARGS is initialized in mavenrc_pre.bat with : -Dhttp.nonProxyHosts=maven -Pjrebel
http://hg.netbeans.org/core-main/rev/affb5363a53a http://hg.netbeans.org/core-main/rev/125df70956a2 these 2 changeset should fix the problem for you (the dev build where the fix is included will appear as comment later on). Indeed it's possible to remove the second double quote, I was not able to find a scenario where it would fail, with the exception of some old code that was obsolete anyway. Please test with your scenario. I've only turned MAVEN_BATCH_ECHO on to see what is being passed to java executable.
Integrated into 'main-silver', will be available in build *201310230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/affb5363a53a User: Milos Kleint <mkleint@netbeans.org> Log: #237398 apparently a single doublequote is enough here
I've just tested the nightly build with my custom installation of Maven. I can confirm you that the patch works fine for me. Thank you for the correction.
-> marking Verified. (In reply to moghrabi from comment #10) > I've just tested the nightly build with my custom installation of Maven. > > I can confirm you that the patch works fine for me. > > Thank you for the correction.
http://hg.netbeans.org/releases/rev/ba5264927b74
Integrated into 'releases/release74', will be available in build *201311141216* or newer. Wait for official and publicly available build. Changeset: http://hg.netbeans.org/releases/rev/ba5264927b74 User: Milos Kleint <mkleint@netbeans.org> Log: #237398 apparently a single doublequote is enough here
changeset http://hg.netbeans.org/core-main/rev/125df70956a2 is not in release, however passed for me in 7.4 patch 1, when appended two properties to line: set MAVEN_CMD_LINE_ARGS=%* mvn run passed and echo showed props passed correctly.