简体   繁体   中英

Why is Jenkins showing NO (0%)code covered in jacoco reports code coverage summary

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.

在此输入图像描述

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM