Important
JaCoCo Coverage Reports feature is generally available in GitLab 17.6.
If you use this plugin for GitLab's Cobertura Coverage Reports, consider switching to JaCoCo Coverage Reports and removing this plugin from your build.
Tested on Java LTS versions from 11 to 27.
Tested on Gradle versions from 7.0 to 9.8.0.
Usage:
plugins {
id 'name.remal.jacoco-to-cobertura' version '2.0.4'
}
For every JacocoReport task,
this plugin creates a task that converts Jacoco XML report to Cobertura format.
This new task is executed automatically after corresponding JacocoReport task (via finalizedBy).
It can be useful for GitLab test coverage visualization.
The name of created task is <jacoco task name>ToCobertura. Examples:
jacocoTestReport->jacocoTestReportToCoberturajacocoIntegrationTestReport->jacocoIntegrationTestReportToCobertura
By default, *ToCobertura tasks create XML files in the same directory where Jacoco XML report is.
Prefix cobertura- is added to the file name.
Example:
build/reports/jacoco/test/jacocoTestReport.xml->build/reports/jacoco/test/cobertura-jacocoTestReport.xml
This plugin add jacocoToCoberturaTask extension to all JacocoReport tasks.
This extension has type TaskProvider<JacocoToCobertura>
and it's a provider of corresponding *ToCobertura task for the current JacocoReport task.
It can be used like this:
tasks.withType(JacocoReport).configureEach {
println jacocoToCoberturaTask.name // prints corresponding name of `*ToCobertura` task
}The minimum Java version is 11 (from 8). The minimum Gradle version is 7.0 (from 6.1).