使用Intellij IDEA构建项目时,Maven Surefire插件"启动叉错误"

oct*_*pod 7 java intellij-idea surefire maven

我正在尝试使用Intellij IDEA与Maven构建Java插件,直到我遇到错误:

[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
Run Code Online (Sandbox Code Playgroud)

我意识到这是因为这条线(我发现使用-X旗帜)

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.
Run Code Online (Sandbox Code Playgroud)

我碰巧遇到了其他人遇到完全相同的问题:

Maven Surefire 2.13无法在Windows上进行分叉

接受的答案似乎是他的JAVA_HOME环境变量无效,所以我检查了我的:

在此输入图像描述

我还回应了命令提示符上的变量,以确保它中没有任何引号(我也在运行cmd.exe以查看另The system cannot find the path specified一条消息):

在此输入图像描述

我确信我的JAVA_HOME环境变量是正确的.如果是这样的话,还有什么可能导致这个问题?

小智 15

我发现这是一个与Windows相关的错误 -

打开注册表编辑器导航到HKCU\Software\Microsoft\Command Processor\AutoRun并清除值.还要检查HKLM\Software\Microsoft\Command Processor\AutoRun.

  • 也为我工作,我在 6 个月前阅读和练习“cucumber for java”一书时安装的条目中安装了 ansicon (2认同)
  • 另一个“为我工作”。我最近卸载 Anaconda 失败,我的 HKCU AutoRun 有“C:\ProgramData\Anaconda3\condabin\conda_hook.bat”。 (2认同)