In effort to keep the actual Maven project's pom.xml concise and clean, this parent POM generates various build reports for Maven site and Continuous Integration Servers (Jenkins, SonarQube, etc).
This parent POM also includes a profile that allows you to push:-
- project artifacts to Sonatype OSSRH (OSS Repository Hosting)
- Maven generated site to project GitHub page
Add the following configuration to your project's pom.xml:-
<project ...>
<parent>
<groupId>com.github.choonchernlim</groupId>
<artifactId>build-reports</artifactId>
<version>0.3.5</version>
</parent>
...
</project>
mvn clean test site
Create a Maven profile, for example:-
<profiles>
<profile>
<id>sonarqube</id>
<properties>
<sonar.host.url>...</sonar.host.url>
<sonar.sources>src/main/java</sonar.sources>
<sonar.tests>src/test/java</sonar.tests>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.junit.reportsPath>${project.build.directory}/surefire-reports</sonar.junit.reportsPath>
<sonar.jacoco.reportPath>${jacoco.reportPath}</sonar.jacoco.reportPath>
<sonar.jacoco.itReportPath>${jacoco.itReportPath}</sonar.jacoco.itReportPath>
</properties>
</profile>
</profiles>
Run the following goals and profile:-
mvn clean test sonar:sonar -Psonarqube
mvn clean deploy -Possrh-deploy
mvn clean test site -Possrh-deploy
- If the JaCoCo web report is not rendering properly in the GitHub page, please read this post for solution: JaCoCo Web Report Not Rendering Properly in GitHub Pages
- Surefire Maven Plugin - Runs unit tests.
- Maven Failsafe Plugin - Runs integration tests.
- Maven Site Plugin - Generates site.
- JaCoCo Maven Plugin - Code coverage report for JVM languages.
- Maven Project Info Reports Plugin - Generates reports information about the project.
- Maven Surefire Reports Plugin - Parses generated test results from both unit tests and integration tests.
- Maven Javadoc Plugin - Generates Javadoc.
- Maven JXR Plugin - Generates a cross-reference of the project's sources.
- JDepend Maven Plugin - Generates design quality metrics for each Java package.
- Maven Javadoc Plugin - Generates Javadoc.
- Maven PMD Plugin - Generates PMD and CPD reports.
- FindBugs Maven Plugin - Inspects Java bytecode for occurrences of bug patterns.
- TagList Maven Plugin - Generates a report on various tags found in the code.
- Sonar Maven Plugin - Publishes results to Sonarqube.
- Versions Maven plugin - Handles dependencies and plugins date.
- Nexus Staging Maven Plugin - Deploys artifacts to Sonatype OSSRH.
- Maven Source Plugin - Generates source code.
- GitHub Site Plugin - Generates Maven site in project GitHub page.
- Maven Javadoc Plugin - Generates Javadoc.
- Maven GPG Plugin - Signs all of the project's attached artifacts with GnuPG..