Skip to content

Commit

Permalink
Manage jacoco-maven-plugin
Browse files Browse the repository at this point in the history
Add dedicated profile "coverage" to generate separate reports for both
UTs and ITs.

This closes #283
  • Loading branch information
kwin committed Dec 21, 2024
1 parent 477dc35 commit c5059a1
Showing 1 changed file with 58 additions and 4 deletions.
62 changes: 58 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ under the License.
<maven.compiler.target>8</maven.compiler.target><!-- use version numbers without the "1." prefix (supported since javac 5) -->
<surefire.version>3.5.2</surefire.version><!-- for surefire, failsafe and surefire-report -->
<assembly.tarLongFileMode>posix</assembly.tarLongFileMode>
<jacoco.append.ut.file>false</jacoco.append.ut.file><!-- set to true to always append for unit test coverage, overwrites default due to https://github.com/jacoco/jacoco/issues/1676 -->
<jacoco.append.it.file>false</jacoco.append.it.file><!-- set to true to always append for integration test coverage, overwrites default due to https://github.com/jacoco/jacoco/issues/1676 -->

<project.build.outputTimestamp>2024-07-04T18:52:57Z</project.build.outputTimestamp>

Expand Down Expand Up @@ -135,6 +137,7 @@ under the License.
<version.maven-source-plugin>3.3.1</version.maven-source-plugin>
<version.maven-surefire>${surefire.version}</version.maven-surefire>
<version.maven-war-plugin>3.4.0</version.maven-war-plugin>
<version.jacoco-maven-plugin>0.8.12</version.jacoco-maven-plugin>
</properties>

<repositories>
Expand Down Expand Up @@ -346,6 +349,46 @@ under the License.
<artifactId>apache-rat-plugin</artifactId>
<version>${version.apache-rat-plugin}</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${version.jacoco-maven-plugin}</version>
<!-- generate reports for UT and IT coverage separately -->
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- always create a new execution data file (https://github.com/jacoco/jacoco/issues/1676) -->
<append>${jacoco.append.ut.file}</append>
</configuration>
</execution>
<execution>
<id>default-prepare-agent-integration</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<!-- always create a new execution data file (https://github.com/jacoco/jacoco/issues/1676) -->
<append>${jacoco.append.it.file}</append>
</configuration>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-report-integration</id>
<goals>
<goal>report-integration</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down Expand Up @@ -517,14 +560,25 @@ under the License.
</build>
</profile>
<!-- END SNIPPET: release-profile -->
<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jdk9+</id>
<activation>
<!-- this does not support toolchains, https://issues.apache.org/jira/browse/MNG-6943 -->
<!-- this does not support toolchains, https://issues.apache.org/jira/browse/MNG-6943 -->
<jdk>[9,)</jdk>
</activation>
<properties>
<!-- https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-release.html, affects m-compiler-p and m-javadoc-p -->
<!-- https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-release.html, affects m-compiler-p and m-javadoc-p -->
<maven.compiler.release>${maven.compiler.target}</maven.compiler.release>
</properties>
</profile>
Expand All @@ -538,7 +592,7 @@ under the License.
<build>
<pluginManagement>
<plugins>
<!-- Disable execution of some plugins in m2e (https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html) -->
<!-- Disable execution of some plugins in m2e (https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html) -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
Expand All @@ -547,7 +601,7 @@ under the License.
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<!-- no native m2e support yet (https://issues.apache.org/jira/browse/MRRESOURCES-85) -->
<!-- no native m2e support yet (https://issues.apache.org/jira/browse/MRRESOURCES-85) -->
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
Expand Down

0 comments on commit c5059a1

Please sign in to comment.