Merge Jacoco coverage reports into one unique report.

This commit is contained in:
Antonin Delpeuch 2018-09-16 20:31:02 +01:00
parent e98dbc537d
commit 8a9022c631
2 changed files with 60 additions and 2 deletions

View File

@ -25,5 +25,38 @@
<module>pc-axis</module> <module>pc-axis</module>
<!-- Add new extensions here --> <!-- Add new extensions here -->
</modules> </modules>
<build>
<plugins>
<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>
<phase>process-test-resources</phase>
<configuration>
<destFile>${project.parent.build.directory}/report/${project.name}.exec</destFile>
<propertyName>surefireArgs</propertyName>
</configuration>
</execution>
<execution>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.parent.build.directory}/report/${project.name}.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>

29
pom.xml
View File

@ -107,7 +107,7 @@
</goals> </goals>
<phase>process-test-resources</phase> <phase>process-test-resources</phase>
<configuration> <configuration>
<destFile>${project.build.directory}/report/jacoco.xml</destFile> <destFile>${project.build.directory}/report/jacoco.exec</destFile>
<propertyName>surefireArgs</propertyName> <propertyName>surefireArgs</propertyName>
</configuration> </configuration>
</execution> </execution>
@ -117,11 +117,36 @@
<goal>report</goal> <goal>report</goal>
</goals> </goals>
<configuration> <configuration>
<dataFile>${project.build.directory}/report/jacoco.xml</dataFile> <dataFile>${project.build.directory}/report/jacoco.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory> <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
</configuration> </configuration>
</execution> </execution>
<execution>
<id>merge</id>
<goals>
<goal>merge</goal>
</goals>
<phase>prepare-package</phase>
</execution>
</executions> </executions>
<configuration>
<destFile>${project.build.directory}/report/jacoco-merged.exec</destFile>
<fileSets>
<fileSet>
<directory>${project.build.directory}/report</directory>
<includes>
<include>jacoco.exec</include>
</includes>
</fileSet>
<fileSet>
<directory>extensions/target/report</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
</fileSets>
</configuration>
</plugin> </plugin>
</plugins> </plugins>