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.

Bug 153101 - Unable to run Maven builds within NetBeans - CreateProcess IOException
Summary: Unable to run Maven builds within NetBeans - CreateProcess IOException
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on:
Blocks: 208065
  Show dependency tree
 
Reported: 2008-11-13 01:47 UTC by jcrim
Modified: 2012-02-20 19:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jcrim 2008-11-13 01:47:21 UTC
All Maven builds within NetBeans 6.5 result in the same exception:
java.io.IOException: CreateProcess error=5, Access is denied
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
	at java.lang.ProcessImpl.start(ProcessImpl.java:30)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
Caused: java.io.IOException: Cannot run program "C:\java\lib\apache-maven-2.0.9\bin\mvn.bat" (in 
directory "C:\code\project\trunk\"): CreateProcess error=5, Access is denied
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
	at org.netbeans.modules.maven.execute.MavenCommandLineExecutor.run(MavenCommandLineExecutor.java:158)
[catch] at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)

Running mvn using the same directories from the command-line (logged on as the same user) works just fine.
Comment 1 Milos Kleint 2008-11-13 07:27:07 UTC
googling for 
http://www.google.de/search?q=CreateProcess+error%3D5%2C+Access+is+denied
suggests it's a problem with access rights given either to the user account or the maven executable.

I suspect it runs from command line because you have correct rights for the shell executable.
Comment 2 Milos Kleint 2008-11-24 07:58:06 UTC
have you been able to get around the issue? can you share with others how the workaround works and what was the cause if
the issue? thanks.
Comment 3 jcrim 2008-11-24 08:09:46 UTC
It appears that the problem is that the java CreateProcess API can't run a *.bat file - it needs an executable.  For 
example, if I could change it to use "cmd.exe C:\java\lib\apache-maven-2.0.9\bin\mvn.bat", I would - from what I've 
read, that should work; but the validation won't let me use such a value.

The workaround is to manually modify every project to use embedded Maven (unfortunately there's no longer a global 
setting for this) - which is working fine so far. (the most recent versions of the Maven plugin on NB 6.1 weren't 
working for me due to a known bug in the Maven embedder.)  However, I would prefer to be able to use either, since 
I've found embedded Maven to be flakier than command-line Maven.

Thanks --john
Comment 4 Milos Kleint 2008-11-24 08:36:38 UTC
hmm... the non-cmd version seems to work for most people. But I suppose it won't hurt if we use it by default on
windows, correct?
Comment 5 Milos Kleint 2008-11-25 07:40:09 UTC
pushed to maven-dev repository
http://hg.netbeans.org/maven-dev/rev/c18222aa460a

to be pushed to main repository sometimes this week.

juhrik: can you please test on various windows based setups that the change build execution works?


Comment 6 Quality Engineering 2008-11-28 17:17:42 UTC
Integrated into 'main-golden', will be available in build *200811281401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/c18222aa460a
User: Milos Kleint <mkleint@netbeans.org>
Log: #153101 for windows execution, use "cmd /c mvn.bat"
Comment 7 Milos Kleint 2009-05-06 09:50:56 UTC
the fix for this issue introduced other problems with space in path. eg.
http://www.netbeans.org/issues/show_bug.cgi?id=164234

http://hg.netbeans.org/main/rev/7e4af1007d3c

the new code will not use the cmd /c workaround initially, just fallback to it once the problem described in this issue
arises. you can switch to the cmd /c execution permanently by adding -J-Dmaven.run.cmd=true to your etc/netbeans.conf.

It woudl be great if you could test on your setup (i've just tried to simulate it), it should appear in the next few
days in the daily development builds. thanks.

Comment 8 jcrim 2009-05-06 19:42:30 UTC
I'm no longer seeing this problem on Windows, using Windows Vista and a newer version of the JVM:

NetBeans: Executing 'mvn.bat clean install'
NetBeans:      JAVA_HOME =C:\java\jdk1.6.0_13
Scanning for projects...
------------------------------------------------------------------------
Building Logging
   task-segment: [clean, install]
------------------------------------------------------------------------
[clean:clean]
Deleting file set: C:\code\common\log\trunk\log\target (included: [**], excluded: [])
[enforcer:enforce {execution: enforce-versions}]
[resources:resources]
Using 'UTF-8' encoding to copy filtered resources.
...

Most likely I'm no longer seeing this problem b/c Microsoft changed The CreateProcess API in Vista.  It's less likely 
that Sun changed their implementation.

I would think spaces in parameters should always cause the parameter to be wrapped with quotes, whether it's 
after "cmd /c" or not.

Comment 9 Quality Engineering 2009-05-09 06:59:05 UTC
Integrated into 'main-golden', will be available in build *200905090201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/7e4af1007d3c
User: Milos Kleint <mkleint@netbeans.org>
Log: #164234, #153101 quote property values containing spaces on windows, use cmd /c for execution only if failing without it. cmd /c has negative effect of quoting property values
Comment 10 Milos Kleint 2009-05-13 20:54:29 UTC
some more space in path problems here: http://www.netbeans.org/issues/show_bug.cgi?id=164986
I've fixed them for the non-cmd version of execution. please verify it also works for the cmd /c alternative. If not, it
would be great if you could try tweaking the
http://hg.netbeans.org/main/file/58e767a34c9d/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java
execution wrapper and see what works. Thanks.