【发布时间】:2014-05-15 05:05:28
【问题描述】:
我在一个 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>
它正在生成一个零百分比的覆盖率报告。
在测试之前,jacoco.exec 文件大小为零字节,现在大小为 6MB。 我在 pom.xml 中缺少什么吗?
【问题讨论】:
-
嗨 user1226320 你知道为什么你的报告是空的吗?
-
你的 classDumpDir 在哪里? Jacoco 需要 classDumpDir 和 dataFile 来生成我相信的报告