Using the JaCoCo plugin with Gradle 1.6, I can generate my test report, but can not drill down to the source code level


(hlship) #1

I’ve added the plugin to my build.

Although the documentation claims that jacocoTestReport will trigger test, I don’t see that. I have to specify both the test and jacocoTestReport targets.

The report is generated properly, except that you can’t navigate to the source listing; you can only see the overview of the class and its methods, but the method (and constructor) names are not clickable.

I tried adding the following to address this:

jacocoTestReport {

sourceSets sourceSets.main }

… but I get the same results.


(hlship) #2

I went into the samples to try and see if there’s an error in my build script.

$ gr -version

------------------------------------------------------------ Gradle 1.6 ------------------------------------------------------------

Gradle build time: Tuesday, May 7, 2013 9:12:14 AM UTC Groovy: 1.8.6 Ant: Apache Ant™ version 1.8.4 compiled on May 22 2012 Ivy: 2.2.0 JVM: 1.7.0_12-ea (Oracle Corporation 24.0-b28) OS: Mac OS X 10.7.5 x86_64

~/lib/gradle/samples/testing/jacoco/quickstart $ gr jTR :compileJava :processResources UP-TO-DATE :classes :jacocoTestReport SKIPPED

BUILD SUCCESSFUL

Total time: 8.552 secs ~/lib/gradle/samples/testing/jacoco/quickstart $

So you can see that JTR is not triggering test correctly.

Building test and jTR generates a report … without source links.

So I think this is a problem with the plugin, and not with my build script.


(Peter Niederwieser) #3

I think you are hitting: http://forums.gradle.org/gradle/topics/_1_6_rc_1_jacoco_plugin_does_not_show_line_numbers Look there for an easy workaround.

Not sure about the task dependency. Will have to do some research.