java - 如何解决 Maven 和 Jacoco 的特定版本问题?
问题描述
我正在尝试运行“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。
推荐阅读
- konvajs - 在 Konva 中反转 Y 轴
- javascript - 将 jsx 元素与其唯一 ID 进行比较
- java - 编译错误:Android 库未包含在 intellij 插件项目 (java) 中?
- tomcat - tomcat 9 配置问题
- postgresql - 使用 Postgres 和 Knex 更新表中的日期时间值
- java - 如何修复 Spring 中的“本地类不兼容”错误?
- java - 过时的元素引用:尝试获取文本时元素未附加到页面文档
- ruby-on-rails - 如何使用 Nokogiri 访问嵌套的 XML
- linux - 读取 /proc/PID/maps 的短期进程
- javascript - 如何使用 Javascript 或 Jquery 单击按钮打开文件夹位置