ast*_*ack 154 java maven-surefire-plugin opendaylight
请帮我解决这个问题.我不完全理解日志中的错误意味着什么.
[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
Run Code Online (Sandbox Code Playgroud)
xia*_*huo 91
我有同样的问题,并通过添加:
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
Run Code Online (Sandbox Code Playgroud)
整个插件元素是:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
小智 43
就我而言,该问题与将日志输出到IntelliJ IDEA控制台(OS Windows 10)中的时间过长有关。
命令:
mvn clean install
Run Code Online (Sandbox Code Playgroud)
此命令为我解决了这个问题:
mvn clean install > log-file.log
Run Code Online (Sandbox Code Playgroud)
小智 32
我有类似的问题(Maven build和maven-failsafe-plugin - 分叉的虚拟机没有正确说再见就终止了)并找到了三个适合我的解决方案:
问题是maven插件maven-surefire-plugin仅在版本2.20.1和2.21.0中.我检查过你使用版本2.20.1.
将插件版本升级到2.22.0.在pom.xml中添加:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
Run Code Online (Sandbox Code Playgroud)
将插件版本降级到2.20.在pom.xml中添加:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
</plugin>
Run Code Online (Sandbox Code Playgroud)
使用插件配置testFailureIgnore.在pom.xml中添加:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
maj*_*man 31
截至今天(10/30/2018),我们注意到我们的构建在Jenkins中出现了这个错误.
该错误有点误导,需要查看转储输出target/surefire-reports/ 以查看以下错误消息:
Error: Could not find or load main class org.apache.maven.surefire.booter.ForkedBooter
Run Code Online (Sandbox Code Playgroud)
这导致我在下面的SO帖子中提到了OpenJDK 181中可能存在的错误:Maven surefire无法找到ForkedBooter类
该帖子中的任何一个修复程序都解决了我的问题.具体来说,我使用其中一个:
maven:3.5.4-jdk-8到maven:3.5.4-jdk-8-alpinepet*_*erh 29
我的场景是
mvn从命令行执行该命令则不会发生该错误。.dump没有任何来自 Surefire 插件的文件或hs_err来自 Java 二进制文件的传统崩溃文件的迹象。有两件事对我来说始终是解决方案(它们是替代方案):
forkcount = 0。forkedProcessExitTimeoutInSeconds从 30 秒增加到 300 秒。插件文档说,如果达到此超时,您将看到错误消息There was a timeout in the fork。我没有看到这样的错误消息,但它始终如一地修复了问题以增加此超时值。您可能希望使用解决方案 (2),因为分叉是可取的。
我的理论是,如果有大量日志输出,那么在 fork 关闭时仍然需要进行大量处理(特别是如果您在捕获输出的 IDE 中运行,并且可能使用内存映射文件作为其窗口内容)。简而言之:在测试完成时,仍有大量文本等待转发到您的 IDE。看来30多岁还不够。
这也解释了为什么有些开发人员会看到这个问题,而另一些开发人员则不会。测试完成时还剩下多少输出处理可能是 CPU 功率、磁盘速度等的函数。
如果我是对的 - 无法证明这一点 - 那么所有像重定向日志输出和降低日志记录级别之类的建议都是 IMO 治疗症状,而不是原因。
小智 21
Surefire FAQ的这一部分可以帮助您:
Surefire失败并显示消息"分叉的虚拟机在没有正确说再见的情况下终止"
Surefire不支持随时调用System.exit()的测试或任何引用库.如果他们这样做,他们与surefire不兼容,你可能应该向库/供应商提出问题.或者,分叉的VM也可能由于多种原因而崩溃,这也可能导致此问题发生.查找表示VM崩溃的经典"hs_err*"文件,或者在测试执行时检查运行maven的日志输出.崩溃进程的一些"非常"输出可能会被转储到控制台/日志中.如果这种情况发生在CI环境中并且仅在一段时间后运行,那么您的测试套件很可能会泄漏某种操作系统级别的资源,这会使每次运行都变得更糟.常规的os级监控工具可能会给你一些指示.
刚刚面临同样的问题,ubuntu上的java 8
它似乎是一个最新的插件版本2.22.1与java 8 https://issues.apache.org/jira/browse/SUREFIRE-1588
通过本地mvn设置遵循建议的解决方法 ~/.m2/settings.xml
<profiles>
<profile>
<id>SUREFIRE-1588</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
</properties>
</profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)
小智 7
使用 maven surefire 2.21.0 我解决了将reuseForks选项值从true更改为false 的问题:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
我在构建下的整个配置部分看起来像:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<skip>false</skip>
<reuseForks>false</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<argLine>-Dfile.encoding=UTF-8</argLine>
<useSystemClassLoader>false</useSystemClassLoader>
<includes>
<!--Test* classes for the app testing -->
<include>**/directory/Test*.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
小智 7
版本 2.22.2 有分叉 JVM 的实际问题。使用 2.20 版 - 它就像一个魅力!
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
Run Code Online (Sandbox Code Playgroud)
我今天遇到了同样的问题,对我来说,真正的问题是在日志中进一步报告并带有消息Cannot use a threadCount parameter less than 1; 1 > 0.<threadCount>1</threadCount>在surefire-plugin配置中添加时,其他错误消失了.
<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>
Run Code Online (Sandbox Code Playgroud)
...是的,我在此测试框架中使用junit和testng,以实现向后兼容性.
在JDK 1.8.0_ 65上使用Jacoco插件运行mvn命令时遇到类似问题
[INFO]
A fatal error has been detected by the Java Runtime Environment:
JRE version: Java(TM) SE Runtime Environment (8.0_65-b17) (build 1.8.0_65-b17).........
Problematic frame:
PhaseIdealLoop::build_loop_late_post(Node*)+0x144
............
............
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test (default-test) on project
The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Run Code Online (Sandbox Code Playgroud)
JDK中有一个错误https://bugs.openjdk.java.net/browse/JDK-8081379
解决方案是使用param -XX:-UseLoopPredicate运行mvn clean install
或者只是对JDK进行更新(我认为较新的次要版本有效)
我遇到过一个案例,提供的答案都没有解决问题。这是一个遗留应用程序,它恰好使用 log4j 和 SLF4J/logback。
以前的情况:clean test从 Eclipse 中启动时,构建运行良好,但在命令行中启动时,出现此错误。建立在 CircleCI 上的 CI 也运行良好。
我所做的:出于纯粹的猜测,配置适当logback-test.xml并降低日志记录的详细程度。瞧,我不再遇到此错误,我现在可以从命令行构建项目(以及发生此错误的模块)。
我的观点是日志框架的使用或配置方式可能是另一种解释。
这真的是 log4j 和 logback 之间的冲突吗?或者只是测试产生的大量日志以某种方式溢出了命令行缓冲区?我不知道。这对我来说仍然是个谜。
小智 6
关闭maven-surefile-plugin的useSystemClassLoader应该有帮助
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我在使用 Java 8 和 Spring Boot 5.2.7 时遇到了同样的问题(包含插件,开箱即用)。插件的版本是默认的(2.22.2)。就我而言,问题仅发生在团队中的某些机器上,而在其他机器上一切正常。我猜这与 Maven 检测到的核心数量有关。
我用这些设置修复了它:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了许多建议的方法,但对我来说没有任何作用。
该解决方案的唯一缺点是禁用分叉的重用,并且测试现在运行速度较慢。
对我有用的解决方案,设置:<forkCount>0</forkCount>
IE
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>0</forkCount>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
如果有人包含自定义argLine参数,则必须重新考虑,因为它可能是内存分配问题的根源.
例如(我以前):
<argLine>XX:MaxPermSize=4096m ${argLine}</argLine>
Run Code Online (Sandbox Code Playgroud)
现在我使用硬指定值:
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
Run Code Online (Sandbox Code Playgroud)
无论出于何种原因,与Socofire集成的应用程序(如Jacoco)不要求足够的内存与构建时发生的测试共存.
小智 5
我也在Jenkins Docker容器中遇到了这个问题(尝试了jenkins:lts,jenkins,jenkins:slim和jenkins:slim-lts。我不想遍历所有存储库并为每个项目更新pom,所以我刚刚将disableClassPathURLCheck添加到maven命令行调用中:
mvn test -DargLine="-Djdk.net.URLClassPath.disableClassPathURLCheck=true"
Run Code Online (Sandbox Code Playgroud)
这似乎是某些 Windows 机器上的线程同步问题。如果您在使用 Windows 时遇到此问题,请尝试将输出重定向到一个文件:mvn clean install > output.txt
小智 5
你可以使用下面的命令。因为你的单元测试需要 fork。关于您在单元测试中使用线程的问题。
mvn test -DforkCount=2
Run Code Online (Sandbox Code Playgroud)
我希望。它很有帮助。
| 归档时间: |
|
| 查看次数: |
120851 次 |
| 最近记录: |