使用 Intellij IDEA 构建项目时 Maven Surefire 插件“启动 fork 时出错”

问题描述 投票:0回答:2

我尝试使用 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

我意识到这是因为这一行(我发现使用

-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.

我碰巧遇到其他人也有同样的问题:

Maven Surefire 2.13 无法在 Windows 上分叉

接受的答案似乎是他的

JAVA_HOME
环境变量无效,所以我检查了我的:

enter image description here

我还在命令提示符上回显了该变量,以确保其中没有任何引号(我还运行

cmd.exe
来查看另一条
The system cannot find the path specified
消息):

enter image description here

我确信我的

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

java maven intellij-idea surefire
2个回答
17
投票

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

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


0
投票

此问题的症状之一是 cmd /C "exit /B 0" 将输出“系统找不到指定的路径。”

修复方法是 REG DELETE "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v "Autorun"

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.