请帮我解决这个问题。我不太明白日志中的错误是什么意思。
[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
截至今天(2018年10月30日),我们注意到我们的构建在Jenkins中出现了这个错误。
这个错误有点误导人,需要查看target/surefire-reports/中转储的输出,才能看到以下错误消息:
Error: Could not find or load main class org.apache.maven.surefire.booter.ForkedBooter
这让我想到了下面的SO帖子,其中提到了OpenJDK 181中一个可能的错误:Maven surefire无法找到ForkedBooter类
那篇文章中的任何一个修复都解决了我的问题。具体来说,我使用了其中之一:
从docker容器maven:3.5.4-jdk-8中的构建切换到maven:3.5.4-jdk-8-alpine
重写Spring Boot的类加载器详细信息请参见:https://stackoverflow.com/a/50661649/1228408
我今天也遇到了同样的问题,对我来说,真正的问题是在日志中进一步报告的消息不能使用threadCount参数小于1;1 > 0。
当在surefire-plugin配置中添加<threadCount>1</threadCount>时,其他错误消失。
Full plugin config:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.18.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.18.1</version>
</dependency>
</dependencies>
<configuration>
<threadCount>1</threadCount>
</configuration>
</plugin>
...是的,为了向后兼容,我在这个测试框架中同时使用了junit和testng。
我在MacOS上远程调试端口5005上的Selenium测试代码时也遇到了这个问题。这个问题原来是由一个仍然运行的剩余的surefire-fork jvm引起的。Eclipse IDE终端的日志输出没有显示底层问题“Address already in use”。只有当我在MacOS终端上运行Eclipse实际试图运行的相同命令时,才会显示日志消息:
/bin/sh -c cd /path/to/your/project/directory && /Library/Java/JavaVirtualMachines/adoptopenjdk-8.使用实例jdk/Contents/Home/jre/bin/java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -jar /path/to/target/surefire/surefirebooter230340673926465933.jar /path/to/target/surefire 2019-06-28T10-50-02_140-jvmRun1 surefire6455775580414993159tmp surefire_02461993428448591420tmp
杀死流氓JVM实例(在Activity Monitor中查找java进程名)解决了这个问题。顺便说一下,我正在运行surefire插件版本2.21.0,与开放jdk 8 (v1.8.0_212)没有问题。注意,所有路径都将特定于您的构建环境,可能还有端口(address=5005)。