【问题标题】:How to merge 2 jacoco coverage reports (.exec file) irrespective of maven life cycle无论 maven 生命周期如何,如何合并 2 个 jacoco 覆盖率报告(.exec 文件)
【发布时间】:2018-02-23 06:04:29
【问题描述】:

我的 pom 中有一个 jacoco 插件来获得 junit 测试覆盖率,我正在从不同的服务器转储另一个报告。无论 maven 生命周期如何,如何合并这 2 个 jacoco 覆盖率报告(.exec 文件)。

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.7.6.201602180812</version>
    <executions>
      <execution>
        <goals>
          <goal>prepare-agent</goal>
        </goals>
        <configuration>
          <destFile>${project.build.directory}</destFile>
        </configuration>     
      </execution>
    </executions>        
</plugin>

【问题讨论】:

    标签: maven merge code-coverage jacoco jacoco-maven-plugin


    【解决方案1】:

    您可以使用“合并”目标,将其与您选择的阶段绑定:http://www.eclemma.org/jacoco/trunk/doc/merge-mojo.html

    也许有这样的配置:

    <plugin>
        <artifactId>jacoco-maven-plugin</artifactId>
        <executions>
            ...
            <execution>
                <id>merge-all-jacoco</id>
                <goals><goal>merge</goal></goals>
                <phase>install</phase>
                <configuration> 
                  <destFile>merged.exec</destFile> 
                  <fileSets>
                    <fileSet>
                      <directory>${project.build.directory}</directory>
                      <includes>
                        <include>*.exec</include>
                      </includes>
                    </fileSet>
                  </fileSets>
                </configuration> 
            </execution>
    </plugin>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-13
      • 2019-03-16
      • 2018-09-09
      • 2014-12-15
      • 2022-06-15
      • 2019-04-10
      相关资源
      最近更新 更多