4
votes

I am using maven as build tool. Jacoco for code coverage. Jenkins for CI. Everything is configured properly in pom.xml However, when build is successful, the code coverage report shows 0% code covered.

enter image description here

I configured fields for jacoco on jenkins as, Path to exec files: **/project_name/target/coverage-reports/jacoco-unit.exec

Path to class directories: **/project_name/target/classes

Path to source directories **/project_name/src/main/java

Inclusions: Firstly I tried with **/*Test.class, **/*Spec.class & later by keeping field blank

Just to check if my jacoco version is wrong, I even looked into this

Jacoco version too is correct.

The HTML reports too are generated properly in target

I am wondering why jenkins is not displaying

1
Might be a version issue, check my answer here stackoverflow.com/a/43781846/604218 - Roberto
this was a version issue. thanks Roberto - Sachin Tiwari

1 Answers

0
votes

This is for other people who search for similar solution...

  1. Check the size of the jacoco.exec file, it shouldn't be 0KB
  2. Make sure you stop all the JVM Gracefully
  3. Make sure while generating report you are pointing to the right source.