【发布时间】:2022-02-10 15:17:18
【问题描述】:
我已经在我的项目中集成了jacoco-maven-plugin,基于这个优秀的指南:http://www.petrikainulainen.net/programming/maven/creating-code-coverage-reports-for-unit-and-integration-tests-with-the-jacoco-maven-plugin/
Jacoco 插件运行良好。但是,maven-site-plugin 不包括站点中的 Jacoco 报告。更具体地说:“项目报告”部分没有列出 Jacoco 报告。 Jacoco 报告本身可在target/site/jacoco-ut 和target/site/jacoco-it 目录中找到。
这就是我所做的(到目前为止没有成功)。
首先,将jacoco-maven-plugin 作为插件包含在我的pom.xml 的build 部分中,如上面引用的指南中所述。我正在使用 Jacoco 版本 0.6.4.201312101107。
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
<executions>
<!-- scissors... -->
<!-- report goal is bound to the pre-site phase -->
</executions>
</plugin>
其次,将jacoco-maven-plugin 包含在我的pom.xml 的report 部分中:没有成功。
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
</plugin>
第三,尝试在report部分的jacoco-maven-plugin中添加reportsets部分:没有成功。
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
<reportSets>
<reportSet>
<reports>
<report>report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
谁能帮我让maven-site-plugin 引用 Jacoco 在网站“项目报告”部分生成的覆盖率报告?
【问题讨论】: