java无法运行jacoco代码覆盖工具
我有一个maven项目(link),我想对其运行代码覆盖率
我在主项目pom文件上运行了命令mvn test -Pcoverage jacoco:prepare-agent jacoco:report
,但没有生成报告。相反,我得到的警告是
[INFO] --- jacoco-maven-plugin:0.7.7.201606060606:report (post-test) @ pulsar-discovery-service ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.7.201606060606:prepare-agent (default-cli) @ pulsar-discovery-service ---
[INFO] argLine set to -javaagent:/home/jai1/.m2/repository/org/jacoco/org.jacoco.agent/0.7.7.201606060606/org.jacoco.agent-0.7.7.201606060606-runtime.jar=destfile=/home/jai1/pulsar/pulsar-discovery-service/target/jacoco.exec
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.7.201606060606:report (default-cli) @ pulsar-discovery-service ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
有人能建议我如何用这个pom file生成代码覆盖率报告吗。我正在使用apache-maven-3.3.9和testNG
# 1 楼答案
下面是一个完整的简单演示项目,展示了单元、集成和测试。测试覆盖率通过Jacoco显示
享受sipmle demo project
# 2 楼答案
Your pom.xml包含
而JaCoCo documentation for ^{} goal 州
# 3 楼答案
请查看以下pom:
然后在maven surefire插件中,应该定义以下内容:
# 4 楼答案
以下是对我们有效的方法:
设置一些属性:
以及
coverage
简介: