Define as parent to project's pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.github.xerprojects</groupId>
<artifactId>xerj.parent</artifactId>
<version>...</version>
</parent>
...
</project>
-
Allows maven to download packages from the snapshots repository: https://oss.sonatype.org/content/repositories/snapshots
Usage:
mvn verify -Psnapshots
-
Enables jacoco code coverage and reports for unit tests.
By default, jacoco will require a minimum of 80% coverage. This san be configured by
jacoco.instruction.coverage
property.Usage:
mvn verify -Pcode-coverage
mvn verify -Pcode-coverage -Djacoco.instruction.coverage=0.50
- This will override coverage requirement to 50%.
Note:
If a child pom needs to define a customargLine
configuration inmaven-surefire-plugin
, it will need to add a@{surefire.jacoco.args}
the theargLine
in order for jacoco to work correctly. Otherwise, jacoco should just work out of the box.<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <argLine> @{surefire.jacoco.args} ... </argLine> </configuration> </plugin>
-
Enable maven-failsafe-plugin integration test and jacoco reports.
Usage:
mvn verify -Pintegration-test
Note:
If a child pom needs to define a customargLine
configuration inmaven-failsafe-plugin
, it will need to add a@{failsafe.jacoco.args}
to theargLine
in order for jacoco to work correctly. Otherwise, jacoco should just work out of the box.<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <configuration> <argLine> @{failsafe.jacoco.args} ... </argLine> </configuration> </plugin>
-
Enables release plugins such as:
- maven-source-plugin
- maven-javadocs-plugin
- maven-gpg-plugin
Usage:
mvn release:clean release:prepare release:perform -Prelease
Profiles can be combined such as:
mvn clean verify -Pcode-coverage,integration-test
- this will run both code coverage and integration tests for the project. It will also generate jacoco coverage reports.