• Home
  • Docker
  • Kubernetes
  • LLMs
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • Archived
Maven | JaCoCo: Java Code Coverage Library
  1. JaCoCo Maven Plugin (0.8.8)
  2. The goal help
  3. Example

  1. JaCoCo Maven Plugin (0.8.8)
    Provides the JaCoCo runtime agent to your tests and allows basic report creation.

    Plugin coordinates:
    • Group Id: org.jacoco
    • Artifact Id: jacoco-maven-plugin

    Goal Prefix: jacoco

    The jacoco plugin has the following goals:
    • help: Display help information on jacoco-maven-plugin.

    • prepare-agent: Prepares a property pointing to the JaCoCo runtime agent that can be passed as a VM argument to the application under test.

    • prepare-agent-integration: Same as prepare-agent, but provides default values suitable for integration-tests.

    • report: Creates a code coverage report for tests of a single project in multiple formats (HTML, XML, and CSV).

    • report-aggregate: Creates a structured code coverage report (HTML, XML, and CSV) from multiple projects within reactor.

    • report-integration: Same as report, but provides default values suitable for integration-tests.

    • check: Checks that the code coverage metrics are being met.

    • instrument: Performs offline instrumentation.

    • restore-instrumented-classes: Restores original classes as they were before offline instrumentation.

    • merge: Mojo for merging a set of execution data files (*.exec) into a single file.

    • dump: Request a dump over TCP/IP from a JaCoCo agent running in tcpserver mode.
  2. The goal help
    The goal help gives general information about the jacoco plugin and lists its goals.
    The parameter detail gives detailed information about the parameters of the goals of the jacoco plugin.

    You can also use the goal describe of the help plugin to get information about the jacoco plugin and lists its goals:

    The parameter goal gives information about a goal of the jacoco plugin:
  3. Example
    Adjust your pom file with the following:

    Run the command "mvn clean verify" to create the code coverage report.

    The main HTML page of the report can be found in: target/site/jacoco/index.html
© 2025  mtitek