How to generate Jacoco test report for a .jar file?

Viewed 122

I'm very new to Gradle. I have written the test suites. However,

jacoco report doesn't show any classes from .jar file

jacoco report doesn't show any classes from .jar file

With this setting below, jacoco runs very well with normal java files.

This is my build.gradle:

plugins {
    id 'java'
    id 'jacoco'
}

version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

jacoco {
    toolVersion = "0.8.5"
    reportsDir = file("$buildDir/customJacocoReportDir")
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    testCompile 'org.hamcrest:hamcrest-all:1.3'
    compile files('libs/PACV1.jar') //this is where I put the jar file
}

jacocoTestReport {
    reports {
        xml.enabled false
        csv.enabled false
        html.destination file("${buildDir}/jacocoHtml")
    }
}

jacocoTestReport.dependsOn test
0 Answers
Related