首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jacoco报告- aggregate -包括aggregate项目的报告

Jacoco报告- aggregate -包括aggregate项目的报告
EN

Stack Overflow用户
提问于 2018-12-31 13:17:54
回答 4查看 3.4K关注 0票数 1

我有一个多模块的maven项目。

代码语言:javascript
复制
parent
   child1
   child2
   child3-report

所有子项目都有单元测试,child3依赖于child1child2。遵循child3的pom

代码语言:javascript
复制
<plugin>
     <groupId>org.jacoco</groupId>
     <artifactId>jacoco-maven-plugin</artifactId>
     <version>0.8.2</version>
     <executions>
        <execution>
            <id>prepare-agent</id>
            <goals>
                <goal>prepare-agent</goal>
            </goals>
        </execution>
        <execution>
            <id>report-aggregate</id>
            <phase>verify</phase>
            <goals>
                <goal>report-aggregate</goal>
            </goals>
        </execution>
    </executions>
</plugin>

生成的jacoco聚合报告仅包括child1和child2的报告,而不包括child3的报告。如何解决这个问题?

我不想只为报表创建第四个子模块。

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2020-06-11 01:17:05

在jacoco github repo上有多个与此功能相关的问题(https://github.com/jacoco/jacoco/issues/812)。对于少数人来说,单独的模块只用于报告可能是可以接受的,但更好的方法是用一些可配置的标志来解决这个问题。

还有一个未决的PR (https://github.com/jacoco/jacoco/pull/1007)。

票数 1
EN

Stack Overflow用户

发布于 2020-06-10 03:53:41

我所做的是添加一个报告目标,以包括模块本身的报告。

代码语言:javascript
复制
<execution>
  <id>report-unit-tests</id>
  <goals>
    <goal>report</goal>
  </goals>
</execution>
票数 1
EN

Stack Overflow用户

发布于 2019-08-21 19:04:41

在为Maven项目实现Jacoco时,我遇到了同样的问题。不幸的是,恐怕唯一的解决方案是向Maven项目添加一个新的子模块。您应该在其中添加对您的3个子模块和报表聚合目标的依赖。因此,您应该具有类似于以下配置的内容:

代码语言:javascript
复制
parent --> Goal: Prepare agent
   child1 --> Goal: report
   child2 --> Goal: report
   child3-report --> Goal: report
   child4-Aggregator --> Goal: report-aggregate

在父pom.xml中,您应该添加子4聚合器模块作为要运行的最后一个模块。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53983849

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档