Enforce and report code quality with JUnit, JaCoCo, Hamcrest, FindBugs, PMD, CodeNarc, Checkstyle (Google), Enforcer, Duplicate-Finder, JDepend, and more with this Maven POM.
- 1. Overview
- 2. Prerequisite software
- 3. Installation
- 4. Usage
- 5. Semantic version and
CHANGELOG
- 6. Contributing to
maven-code-quality-pom
- 7. License
Enforce and report code quality with:
- Checkstyle with Google Java coding standards (
maven-checkstyle-plugin
) - CodeNarc (
codenarc-maven-plugin
) - Duplicate-Finder (
duplicate-finder-maven-plugin
) - Enforcer (
maven-enforcer-plugin
) - FindBugs (
findbugs-maven-plugin
) - fmt-maven-plugin formats your code using
google-java-format
, which follows Google's code styleguide (fmt-maven-plugin
) - JDepend (
jdepend-maven-plugin
) - JUnit (
junit5
withjunit4
backwards compatibility) - JaCoCo (
jacoco-maven-plugin
) - PMD (
maven-pmd-plugin
) - Report site generation (
maven-site-plugin
)
and more with this Maven POM.
The purpose of the project is to use the Maven Site Plugin to:
- Use the Maven Site Plugin to generate meaningful test and quality reporting artifacts
- Enforce test coverage thresholds and code standards
- Prevent source code that does not conform to standards from being merged into
master
.
maven-code-quality-pom
is written in Java, which must be installed prior to use. maven-code-quality-pom
manages Java dependencies with Maven and NPM for JavaScript dependencies.
-
Java™️ EE 8 SDK: Either
-
Node.js, which includes the node package manager (npm).
💡 If you're working on macOS, we recommend installing or updating software with Homebrew.
- Fork or clone this repository.
$ git clone https://github.com/gregswindle/maven-code-quality-pom.git
$ cd maven-code-quality-pom
- Install with Maven:
$ mvn clean install -DskipTests=true -Dmaven.javadocs.skip=true -B -V
- Install Node.js dependencies:
$ npm install
$ mvn test verify
To build the Maven reports site, open a Terminal and run:
$ mvn site
Then open maven-code-quality-pom/target/site/index.html
in a Web browser.
-
Formats all src/ and test/ Java code according to the Google Java style guide.
ℹ️
mvn fmt:format
runs with every build. -
Executes the defined enforcer-rules once per module and displays the current platform information
-
Generates the site for a single project.
-
Performs Checkstyle analysis and outputs violations or a count of violations to the console, potentially failing the build.
-
Finds duplicate classes/resources on the classpath.
-
Identify defect (bug) patterns in your Java source code.
-
Fail the build if there were any PMD violations in the source code.
-
Fail the build if there were any CPD violations in the source code.
Before you connect to SonarCloud, you need:
- An active account on https://sonarcloud.io
- To set the
ENVIRONMENT
variable$SONAR_TOKEN
See "Using SonarCloud with Travis CI" for details.
Open a Terminal and run:
$ mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar
The latest version of maven-code-quality-pom
is 0.0.1-SNAPSHOT
. View the CHANGELOG
for details.
We welcome contributors with Pull Requests!
🍀 Read Contributing to maven-code-quality-pom
to get started. 🍀
Contributions in the form of GitHub pull requests are welcome. Before embarking on a significant change, please adhere to the following guidelines:
- Read the Code of Conduct.
- Create an issue to discuss the proposed change and ensure that it is likely to be merged:
- Report a defect (aka "bug")
- Request a new feature
- Follow Contributing to
maven-code-quality-pom
's coding conventions and Git workflow if you're willing and able to program (or want to learn how).
MIT © Greg Swindle.