Jacoco code coverage issue

Hi team,
When I’m trying to run the maven project using jacoco plugin to check the code coverage results I am facing huge issue.
When I am trying to run in my local environment using jacoco few test cases aren’t showing coverage results and getting the below error.

[INFO] — jacoco-maven-plugin:0.7.6.201602180812:report (post-unit-test) @ kcam —
[INFO] Analyzed bundle ‘KCAM :: 1.1.1-SNAPSHOT’ with 79 classes
[WARNING] Classes in bundle ‘KCAM :: 1.1.1-SNAPSHOT’ do no match with execution data. For report generation the same class files must be used as at runtime.
[WARNING] Execution data for class XXXXXXXX does not match.
[WARNING] Execution data for class XXXXXXXX does not match.
[WARNING] Execution data for class XXXXXXXX does not match.
[WARNING] Execution data for class XXXXXXXX does not match.[

Here is the jacoco related plugin details in my pom.xml

junit junit 4.10 test ${project.build.directory}/filtered-sources/java src/main/resources true src/main/java true ../filtered-sources/java maven-compiler-plugin 3.5.1 1.8 1.8 org.apache.maven.plugins maven-surefire-plugin 2.19.1 ${runSuite} org.apache.maven.plugins maven-assembly-plugin 2.4.1 jar-with-dependencies DFFConverter false ${mainClass} make-assembly package single org.apache.maven.plugins maven-jar-plugin 3.0.2 com.amd.kdf.kcam.Main
      <!-- Sonar-JaCoCo integration plugin -->
org.jacoco jacoco-maven-plugin 0.7.6.201602180812 prepare-agent prepare-agent report prepare-package report post-unit-test test report target/jacoco.exec target/jacoco.exec org.apache.maven.wagon wagon-webdav-jackrabbit 2.10

let me know what is the cause of getting zero coverage using jacoco plugin

Hi,

Are you running the tests/generating the report with the same class files and in the same location that you’re running analysis from?

 
Ann

Yes ann.running with same lass files in the same location

Hi,

I Googled the error message that’s repeated & got this SO answer. Which led me to this one about the first error in your log. It seems that something changes during your build/test/analyze process.

 
:woman_shrugging:
Ann