I 'm using maven-sure fire plugin to execute tests and Jacoco plugin to generate the coverage reports. Jacoco does't provide coverage reports and instead fails with the debug log as shown here under.
[INFO] --- jacoco-maven-plugin:0.8.0:report (jacoco-site) @ util ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
Here is how the maven sure-fire plugin looks.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<parallel>classes</parallel>
<threadCount>8</threadCount>
<forkCount>4</forkCount>
<encoding>UTF-8</encoding>
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>UTF-8</outputEncoding>
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=128m -ea
-Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>
Here is how the Jacoco plugin looks like.
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.0</version>
<configuration>
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…