Jacoco merge/generate/publish: Execution data for class does not match

134 views
Skip to first unread message

Pooja Shah

unread,
Nov 27, 2023, 1:22:28 AM11/27/23
to JaCoCo and EclEmma Users
Hi there, 
Screenshot 2023-11-27 at 11.42.46 AM.png
I have plugged in Jacoco to capture coverage from my instrumented tests. 
While it's generating coverage for most of the files, at the same time for many files, it's failing with "Execution data for class <my_classes> does not match"


Steps I followed:

Step 1: with jacoco enabled, built (which had jacocoDevDebug executed)
Step 2: Save the ".class" files to refer later
Step 3: ran tests with coverage on and save the coverage ".ec" files in artifacts
Step 4: download both (.ec and .class files)
Step 5: given them to  jacoco task to publish the coverage  (It should interanlly merege them)

While many of them merges smoothly, many still cry for "execution data does not match". (I checked, these are both java and kotlin classes) 

reports {
csv.enabled true
csv.destination file("${rootProject.buildDir}/jacoco/coverage-report.csv")
xml.enabled true
xml.destination file("${rootProject.buildDir}/jacoco/coverage-report.xml")
html.enabled true
html.destination file("${rootProject.buildDir}/jacoco/html-report")
}


def javaClasses = []
def kotlinClasses = []
def javaSrc = []
def kotlinSrc = []
def javaPath = "intermediates/javac"
def kotlinPath = "tmp/kotlin-classes"

javaSrc << "$proj.projectDir/src/main/java"
kotlinSrc << "$proj.projectDir/src/main/kotlin"
javaClasses << fileTree(dir: "<my_path>/build/${javaPath}/devDebug", excludes: fileFilter)
kotlinClasses << fileTree(dir: "<my_path>/build/${kotlinPath}/devDebug", excludes: fileFilter)

sourceDirectories.from = files([javaSrc, kotlinSrc])
classDirectories.from = files([javaClasses, kotlinClasses])

getExecutionData().setFrom(
fileTree(dir: "code_coverage", includes: ['**/*.ec']))



Environment Info

OS: 
Linux 5.15.0-1050-azure amd64 Java: openjdk 17.0.9 2023-10-17 JVM: 1.8.0_382
Gradle 7.5 Kotlin: 1.6.21 Groovy: 3.0.10 Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021



What step maybe changing the .class files to make it feel different and marking as "does not match"?
Debug build setting has 
  - Minify false
  - Shrink false 





Screenshot 2023-11-27 at 11.49.08 AM.png

Pooja Shah

unread,
Nov 27, 2023, 1:39:56 AM11/27/23
to JaCoCo and EclEmma Users
Hi @Marc, 
Thanks for your detailed reply here https://groups.google.com/g/jacoco/c/FJ5VAOi2h0s/m/9-I-QzreAgAJ
However I'm stuck at getting this work as in my knowledge, seeing no steps in my pipeline, that would create a difference in runtime vs report generation time.
Is there any steps/CLI tool to investigate/discover the points you mentioned?

Screenshot 2023-11-27 at 12.08.21 PM.png

Pooja Shah

unread,
Nov 27, 2023, 5:26:25 AM11/27/23
to JaCoCo and EclEmma Users
My bad. Missed adding:
Jacoco version is: 0.8.8 
Including it with Gradle using classpath "org.jacoco:org.jacoco.core:0.8.8"

Pooja Shah

unread,
Dec 27, 2023, 3:30:14 AM12/27/23
to JaCoCo and EclEmma Users
Bumping this up. Highly appreciate if anyone can guide or help me 

Pooja Shah

unread,
Jan 19, 2024, 5:20:57 AMJan 19
to JaCoCo and EclEmma Users
Closing this.
Cross posting if it helps you (new reader facing problem) unblock for your case. 
Short: It has to do with a tranformer running before jacoco instrument. In my case it was Intune MamifyTransform.

https://github.com/jacoco/jacoco/issues/1558#issuecomment-1900073052
Reply all
Reply to author
Forward
0 new messages