请帮我解决这个问题。我不太明白日志中的错误是什么意思。

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.749s
[INFO] Finished at: Thu Apr 24 10:10:20 IST 2014
[INFO] Final Memory: 15M/37M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test (default-test) on project samples.simpleforwarding: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
[ERROR] Command wascmd.exe /X /C ""C:\Program Files\Java\jdk1.7.0_55\jre\bin\java" -Xmx1024m -XX:MaxPermSize=256m -jar E:\OpenDayLight\controller\opendaylight\samples\simpleforwarding\target\surefire\surefirebooter53410321571238933.jar E:\OpenDayLight\controller\opendaylight\samples\simpleforwarding\target\surefire\surefire86076271125218001tmp E:\OpenDayLight\controller\opendaylight\samples\simpleforwarding\target\surefire\surefire_01846991116135903536tmp"
[ERROR] -> [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/PluginExecutionException

当前回答

这也可能是由于一个完全不同的问题。例如,在我的案例中,我们的Jenkins构建在执行测试时毫无理由地间歇性失败。

我筛选了我们的测试,以寻找System.exit()的任何出现,但没有。

经过更多的挖掘,我发现这可能是因为JDK的bug导致了这种回归。

jdk - 6675699

我仍在努力在我们的构建中修复这个问题,将回来并再次更新线程。

其他回答

Surefire FAQ的这一部分可以帮助你:

Surefire fails with the message "The forked VM terminated without properly saying goodbye" Surefire does not support tests or any referenced libraries calling System.exit() at any time. If they do so, they are incompatible with surefire and you should probably file an issue with the library/vendor. Alternatively the forked VM could also crash for a number of reasons, which can also make this issue happen. Look for the classical "hs_err*" files indicating VM crashes or examine the log output from running maven when the tests execute. Some "extraordinary" output from crashing processes may be dumped to the console/log. If this happens on a CI environment and only after some time runs there is a fair chance your test suite is leaking some kind of OS-level resource that makes things worse for every run. Regular os-level monitoring tools may give you some indication.

以上都试过了,都没用。下面的解决方案适合我:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
    <argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>

当我试图在运行JAVA = 1.8的windows 10环境上编译一个设置为1.7的maven项目时,确实遇到了同样的问题。

我通过将java版本从1.7更改为1.8来解决这个问题,如下所示。

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
    </configuration>
  </plugin>

我尝试了所有提供的解决方案(分叉,系统加载器,更多的内存等),没有工作。

环境:在gitlab ci环境中构建失败,在docker容器中运行构建。

解决方案: 我们在2.20.1版本中使用surefireplugin,升级到2.21.0或更高版本(我们使用2.22.1)修复了这个问题。

原因: surefire -1422 - surefire使用ps命令,该命令在docker环境中不可用,导致“崩溃”。此问题在2.21.0或更高版本中修复。

感谢另一个问题的答案:https://stackoverflow.com/a/50568662/2970422

您需要检查您的机器是64位还是32位。如果你的机器是32位的,那么你的内存参数不应该超过4096,即使它应该低于4 GB。 但如果你的机器是64位的,那么安装Java 64位,并在mvn.bat中提供JAVA_HOME,指向Java 64位安装。