Raymond Chenon
Raymond Chenon

Reputation: 12722

jacoco.xml vs jacocoTestReport.xml

In my gradle project, I have jacocoTestReport.xml instead of jacoco.xml . What are the differences between jacoco.xml vs jacocoTestReport.xml ?

On Google, the difference between both file are not clear.

PS: the reason I'm asking is that Code Climate expects a jacoco.xml file for the code coverage.

Upvotes: 0

Views: 5233

Answers (1)

Godin
Godin

Reputation: 10574

By default Gradle task of type JacocoReport uses name of task for name of xml file - https://github.com/gradle/gradle/blob/v5.5.1/subprojects/jacoco/src/main/java/org/gradle/testing/jacoco/plugins/JacocoPlugin.java#L278-L282

Destination file can be customized - for example jacocoTestReport task in following build.gradle

apply plugin: "java"
apply plugin: "jacoco"

repositories {
    mavenCentral()
}

dependencies {
    testCompile "junit:junit:4.12"
}

jacocoTestReport {
    reports {
        xml.enabled = true
        xml.destination = file("build/foo.xml")
    }
}

configured to produce file build/foo.xml instead of default build/reports/jacoco/test/jacocoTestReport.xml.

Upvotes: 6

Related Questions