Skip to main content

Jacoco report with mvn without configuration

No need any configuration inside the pom.xml.

mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report

Explanation

  1. org.jacoco:jacoco-maven-plugin:prepare-agent: Add the agent to the JVM that runs the tests
  2. test: run the test as usual
  3. org.jacoco:jacoco-maven-plugin:report: generate html report

The report is generated in target/site/jacoco

Recommend way to open it:

python3 -m http.server -d target/site/jacoco 8181

then open http://localhost:8181