According to line

jvmArgs "-javaagent:$springInstrument"

you use another agent that I assume also performs bytecode transformations. 
Please make sure that JaCoCo agent is listed first in the command line 
before any other agents, so that it will see unmodified classes.

Also should be noted that seems that Gradle JaCoCo Plugin does not enforce 
this automatically, so please report this to Gradle, who develops the 
plugin.

Offline instrumentation as well as mismatch of classes are described in 
documentation and there are plenty of topics in mailing list about this ( 
e.g. https://groups.google.com/d/msg/jacoco/5IqM4AibmT8/-x5w4kU9BAAJ ) as 
well as in internet. There is nothing to add to all this without having an 
ability to reproduce your difficulty with proper configuration.

On Friday, July 14, 2017 at 1:03:00 PM UTC+2, prateek gupta wrote:
>
> I am trying to generate coverage report using jacoco but unable to do so 
> because of following error :
>
> [ant:jacocoReport] Classes in bundle 'pubmindApp' do no match with 
> execution data. For report generation the same class files must be used as 
> at runtime.
>
> Below is my current build gradle :
>
> configurations {
>     agentlib
> }
> ext{
> isBuildMaster = true
> jacocoversion = '0.7.6.201602180812'
> }
> if (hasProperty('extraChecks') || isBuildMaster == true) {
>   jacocoTestReport {
>    def coverageSourceDirs = ['src/main/java']
>     reports {
>         xml.enabled true
>         html.enabled true
>         csv.enabled false
>     }
>     sourceDirectories = files(coverageSourceDirs)
>   }
>   build.dependsOn(jacocoTestReport)
> }
>
> jacoco {
> toolVersion = jacocoversion
> }
>
> test {
> jacoco {
>             destinationFile = file("$buildDir/jacoco/test.exec")
>             classDumpFile = file("$buildDir/jacoco/classpathdumps")
>     }
>     ext.agentlibs = configurations.agentlib.collect {it}
>     ext.springInstrument = agentlibs[0]
>     // Uncomment the following line to see the test output on console 
>     //testLogging.showStandardStreams = true
>     println("springframework instrument path: $springInstrument")
>     jvmArgs "-Xms256m"
>     jvmArgs "-Xmx4096m"
>     jvmArgs "-XX:MaxPermSize=256m"
>     jvmArgs 
> "-Djava.library.path=${root}/java/lib:${service_root}/home/tivo/lib"
>     jvmArgs "-javaagent:$springInstrument"
>     include "**/Test*.class"
>     exclude 'com/tivo/service/pubmind/trio/TestVodCategoryOperation.class'
>    exclude 'com/tivo/service/pubmind/trio/TestVodCatalogOperation.class'
>     environment('SERVICE_ROOT', service_root);
>     environment('SRCROOT', srcroot);
>     doFirst {
>       if(System.getProperty('extraTests') == '1'){ 
>         include "**/ExtraTest*.class"
>         println "Include  extra tests";
>       } else {
>         println "Skipping extra test, extraTests not enabled";
>       }
>    }
> }
>
> test.finalizedBy jacocoTestReport
>
> I have tried using offline instrumentation, creating classdump but still 
> the same error keeps on popping up. Please help out
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/17a0813c-4073-453e-baec-ab8425e934fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to