Maven Surefire plugin "error in starting fork" while building project with Intellij IDEA

7.8k views Asked by At

I was trying building a Java plugin with Maven using Intellij IDEA until I came across an error:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.803 s
[INFO] Finished at: 2015-06-16T16:34:55-10:00
[INFO] Final Memory: 17M/216M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project mc-hyperchat: Error occurred in starting fork, check output in log -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

I realize that this is because of this line (that I found using the -X flag)

Forking command line: cmd.exe /X /C ""D:\Program Files\Java\jdk1.8.0_45\jre\bin\java" -jar C:\Users\<username>\Documents\+GIT\mc-hyperchat\target\surefire\surefirebooter8505511050498586005.jar C:\Users\<username>\Documents\+GIT\mc-hyperchat\target\surefire\surefire5990474653240919844tmp C:\Users\<username>\Documents\+GIT\mc-hyperchat\target\surefire\surefire_08408900793313340679tmp"
The system cannot find the path specified.

I happen to come across somebody else with the exact same problem:

Maven Surefire 2.13 fails to fork on Windows

The accepted answer seems to be that his JAVA_HOME environment variable was invalid, so I checked mine:

enter image description here

I also echoed the variable on the Command Prompt to make sure it didn't have any quotation marks in it (also me running cmd.exe to see another The system cannot find the path specified message):

enter image description here

I'm convinced my JAVA_HOME environment variable is correct. If that's the case, what else could've caused this problem?

1

There are 1 answers

6
miconico On

I found this to be a windows related error -

Open the Registry Editor Navigate to HKCU\Software\Microsoft\Command Processor\AutoRun and clear the values. Also check HKLM\Software\Microsoft\Command Processor\AutoRun.