java - 如何修复 Maven 和 Jacoco 的特定版本问题?

标签 java maven jacoco maven-surefire-plugin

我正在尝试运行“mvn clean package”来编译我的代码。我收到这样的错误。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test 
(default-test) on project hilton-rest-gen: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: 
The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /Users/ronhoward/rest-gen-develop && /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/bin/java 
-javaagent:/Users/ronhoward/.m2/repository/org/jacoco/org.jacoco.agent/0.8.1/org.jacoco.agent-0.8.1-runtime.jar=destfile=/Users/ronhoward/rest-gen-develop/target/coverage-reports/jacoco-unit.exec 
-jar /Users/ronhoward/rest-gen-develop/target/surefire/surefirebooter11844541132864858315.jar 
/Users/ronhoward/rest-gen-develop/target/surefire/surefire12749876885671721861tmp 
/Users/ronhoward/rest-gen-develop/target/surefire/surefire_03804673154865947634tmp
[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

关于如何处理这个问题有什么建议吗?

最佳答案

根据您的日志,您使用 Java 版本 11 和 JaCoCo 版本 0.8.1

.../JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/bin/java
-javaagent:.../org.jacoco.agent-0.8.1-runtime.jar...

但是根据 JaCoCo 变更日志 https://www.jacoco.org/jacoco/trunk/doc/changes.html JaCoCo 0.8.2 中添加了对 Java 11 的实验性支持,0.8.3 中添加了非实验性支持。

因此,请升级您的 pom.xml 文件以使用此版本或什至更好的版本 - 使用今天发布的最新版本 0.8.4

关于java - 如何修复 Maven 和 Jacoco 的特定版本问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56447229/

相关文章:

java - Maven中相同依赖的不同版本

java - SonarQube 插件未找到 JaCoCo 结果

maven - 如何在构建期间跳过 jacoco 覆盖率检查?

java - AS400 Java Java 程序已完成,退出代码为 1

java - 在 Spring Boot 中按 @onetomany 集合大小排序的最佳方法?

java - Hibernate 数据源与 JNDI 的连接

spring - 使用Maven更新Spring框架版本后Eclipse的Tomcat Server无法启动

java mongo 数组列表保存

java - Dockers 上的多模块 Maven 项目

java - Jacoco 只为单个测试类生成覆盖率报告