[英]Create Jacoco report for external repository
I have a Spring-Boot maven repository.我有一个 Spring-Boot maven 存储库。 I can't alter pom.xml to add jacoco-maven-plugin.
我无法更改 pom.xml 以添加 jacoco-maven-plugin。 But I need a test coverage report for this repository.
但我需要此存储库的测试覆盖率报告。
So my idea was to execute the following command:所以我的想法是执行以下命令:
mvn clean verify org.jacoco:jacoco-maven-plugin:prepare-agent org.jacoco:jacoco-maven-plugin:report
But in the logs I see:但在日志中我看到:
[INFO] --- jacoco-maven-plugin:0.8.6:prepare-agent (default-cli) @ backend ---
[INFO] argLine set to -javaagent:C:\\Users\\admin\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.6\\org.jacoco.agent-0.8.6-runtime.jar=destfile=C:\\projects\\my-project\\backend\\target\\jacoco.exec
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.6:report (default-cli) @ backend ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
and no report is generated.并且没有生成报告。
What should I do to add "missing execution data file"?我应该怎么做才能添加“缺少执行数据文件”? And is it even possible to generate Jacoco report without adding anything to the pom.xml?
甚至可以在不向 pom.xml 中添加任何内容的情况下生成 Jacoco 报告吗?
I figured this thing out.我想通了这件事。 Turns out I needed to change the goal's order a bit.
原来我需要稍微改变一下目标的顺序。
Instead of: mvn clean verify org.jacoco:jacoco-maven-plugin:prepare-agent org.jacoco:jacoco-maven-plugin:report
而不是:
mvn clean verify org.jacoco:jacoco-maven-plugin:prepare-agent org.jacoco:jacoco-maven-plugin:report
I need to do:我需要去做:
Clean干净的
Prepare Jacoco Agent准备 Jacoco 代理
Verify核实
Build report.建立报告。
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify org.jacoco:jacoco-maven-plugin:report
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.