Last active
May 26, 2018 15:37
-
-
Save michaelajr/bcff10f1577a34c57fb6a890e01aded2 to your computer and use it in GitHub Desktop.
Maven For Pipelining, Part 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Run unit tests with code coverage --> | |
<profile> | |
<id>unit-test</id> | |
<activation> | |
<file> | |
<exists>${basedir}/src/test</exists> | |
</file> | |
</activation> | |
<properties> | |
<testAgent></testAgent> | |
</properties> | |
<build> | |
<pluginManagement> | |
<plugins> | |
<!-- Code Coverage --> | |
<plugin> | |
<groupId>org.jacoco</groupId> | |
<artifactId>jacoco-maven-plugin</artifactId> | |
<configuration> | |
<excludes> | |
<exclude>${sonar.coverage.exclusions}</exclude> | |
</excludes> | |
</configuration> | |
<executions> | |
<!-- Before running unit tests --> | |
<execution> | |
<id>preTest</id> | |
<phase>process-test-classes</phase> | |
<goals> | |
<goal>prepare-agent</goal> | |
</goals> | |
<configuration> | |
<skip>${skipUnitTests}</skip> | |
<destFile>${project.build.directory}/jacoco.exec</destFile> | |
<propertyName>testAgent</propertyName> | |
</configuration> | |
</execution> | |
<!-- After running unit tests --> | |
<execution> | |
<id>postTest</id> | |
<phase>test</phase> | |
<goals> | |
<goal>report</goal> | |
</goals> | |
<configuration> | |
<skip>${skipUnitTests}</skip> | |
<destFile>${project.build.directory}/jacoco.exec</destFile> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<!-- Update SureFire (already bound to test phase) --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-surefire-plugin</artifactId> | |
<configuration> | |
<argLine>@{testAgent} ${jvmArgs}</argLine> | |
<skipTests>${skipUnitTests}</skipTests> | |
</configuration> | |
</plugin> | |
</plugins> | |
</pluginManagement> | |
<!-- Use in lifecycle --> | |
<plugins> | |
<plugin> | |
<groupId>org.jacoco</groupId> | |
<artifactId>jacoco-maven-plugin</artifactId> | |
</plugin> | |
</plugins> | |
</build> | |
</profile> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://medium.com/eonian-technologies/maven-for-pipelining-part-1-8b850d10a7ee