小编use*_*320的帖子

使用maven生成JaCoCo报告

我已经在jacoco.exec文件中捕获了覆盖范围详细信息.它的大小为6Mb.我需要使用maven生成一个覆盖率报告.我试过以下

  <dependencies>
    <dependency>
      <groupId>org.jacoco</groupId>
      <artifactId>org.jacoco.ant</artifactId>
      <version>0.7.0.201403182114</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.6.3.201306030806</version>
        <executions>
          <!--
            Ensures that the code coverage report for integration tests after
            integration tests have been run.
          -->
          <execution>
            <id>post-integration-test</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>report</goal>
            </goals>
            <configuration>
              <!-- Sets the path to the file which contains the execution data. -->
              <dataFile>D:/JaCoCo/jacoco.exec</dataFile>
              <!-- Sets the output directory for the code coverage report. -->
              <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>      
    </plugins>
  </build>
Run Code Online (Sandbox Code Playgroud)

它正在生成零百分比的覆盖率报告.

在测试之前,jacoco.exec文件的大小为零字节,现在它的大小为6MB.我在pom.xml中缺少什么?

maven jacoco

13
推荐指数
2
解决办法
2万
查看次数

标签 统计

jacoco ×1

maven ×1