我正在尝试为多模块项目的单元测试添加聚合覆盖率报告。各个模块的覆盖率报告按预期生成。但报告模块目标中生成的聚合报告显示覆盖率为 0%
模块结构如下:
Root
|
|
- - - Components module
|
|
- - - - - - - - - Sub module A
|
|
- - - - - - - - - Sub module B
|
|
- - - - - - - - - Aggregate report module
Run Code Online (Sandbox Code Playgroud)
我关注了这个示例项目:https://github.com/jacoco/jacoco/blob/master/jacoco-maven-plugin.test/it/it-report-aggregate/pom.xml
现有的根 pom 包含插件配置如下,我没有更改任何内容:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>default-instrument</id>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>default-restore-instrumented-classes</id>
<goals>
<goal>restore-instrumented-classes</goal>
</goals>
</execution>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals> …Run Code Online (Sandbox Code Playgroud)