example-jacoco

Example Project to setup JaCoCo

APACHE-2.0 License

Stars
8
Committers
2

JaCoCo Example

This example project is related to a blog article which describes the configuration to use JaCoCo in your Apache Maven project.

Also you can find the article on https://khmarbaise.medium.com/apache-maven-jacoco-configuration-ea3cb592159f

Requirements

  • JDK21+
  • Apache Maven 3.8+ (also Maven 4.0.0-alpha-12+ supported).

The given code example can easily being changed to work with JDK version less than 17, because you can simply replace the given record in the example with a usual final class implemented in the classical way.

JaCoCo Report

To create a full JaCoCo coverage report you could start via:

mvn clean verify

Creating a report which covers only the unit tests can be achieved by:

mvn clean verify -DskipITs

If you like to have the integration test reports only:

mvn clean verify -DskipUTs