Search code examples
gradlejava-8code-coveragejenkins-pluginsjacoco

Jenkins jacoco plugin - Dashboard Reports are gone with Java8


Most of the projects that I'm working with used Gradle 1.6 upto 2.3 with Java7 and I'm using Jacoco for code coverage.

Jenkins version is: 1.565.3 and 1.618 (I have two instances)
Jenkins's Jacoco Plugin version: 1.0.12

Gradle version: 2.3
Gradle's Jacoco Plugin version: 0.7.2.201409121644

Now in Gradle, there's a jacoco plugin (which provides jacocoTestReport task) and in Jenkins there's a Jacoco plugin which reads the exec files generated by running various tests and shows the reports on the Jenkins job's dashboard.

These reports are not showing up now if I'm using Java 8 with Gradle 2.0 upto 2.3 versions. Jenkins jobs builds and runs the analysis on Jacoco successfully but the reports is gone.

Have you seen this issue?

If you see this, it shows Coverage is gone and with the latest build all what is there is RED / no coverage.

Main dashboard: enter image description here

Jacoco Plugin report (if you click on the above report on the job): enter image description here

NOTE:

  1. I have valid .exec files which shows valid code coverage if I use Gradle's jacocoTestReport task to generate the coverage in HTML format but the Jacoco plugin dashboard reports are not showing anything (just shows the headers only with no data/no coverage at all).

  2. Reports generated by jacocoTestReport and Jacoco plugin in Jenkins generated valid output when I'm using Java7.

Report generated by Gradle's jacocoTestReport task using the same .exec files shows that jacoco* .exec files that I have are valid. enter image description here


Solution

  • I figured out the cause why code coverage is not showing for Java 8 projects.

    It's due to the incompatible version of Jenkins's Jacoco Plugin which works only with Java7 in your Jenkins instance. Try updating Jacoco plugin in Jenkins it to the latest version (1.0.15+).

    Support to Java 8 was provided with version 1.0.15. Release notes of Jacoco plugin

    Version 1.0.15 (Jun 11, 2014)
    • Fix [JENKINS-20440] Inspector problem
    • Fix [JENKINS-22716] - Update to JaCoCo 0.7.x to support Java 8
    • Fix #40 - Project Dashboard chart having data cut off

    Hence, jacoco plugin needs to be upgraded in your Jenkins.

    Also, see Version info/Release info here: https://wiki.jenkins-ci.org/display/JENKINS/JaCoCo+Plugin

    You'd notice there's a warning message (at this time) which might be resolved in upcoming versions (in few days).

    Unfortunately JaCoCo 0.7.5 breaks compatibility to previous binary formats of the jacoco.exec files, the JaCoCo plugin is currently based on JaCoCo 0.7.4, thus you cannot use this plugin with projects which already use JaCoCo 0.7.5 or newer, please stick to 0.7.4 or lower for now until the plugin is updated