Comment on page
Java project config (JaCoCo)
Java project configuration required to generate JaCoCo report files for use with Cover Reports
JaCoCo reports are an essential component of Cover Reports. This requires a minor config update for your projects to add the appropriate dependencies and plugins (if you're not already using JaCoCo).
Maven
Gradle (GROOVY)
Gradle (KOTLIN)
Add the following declarations to the
pom.xml
file for the project:<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
</dependency>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
You may also want/need to download an appropriate version of JaCoCo (0.8.3+) for use with your Cover projects as well.
- 1.Add the JaCoCo plugin to your build script (
build.gradle
orbuild.gradle.kts
):
apply plugin: 'jacoco'
- 2.Include the following configuration to enable the generation of the XML reports:
jacocoTestReport {
dependsOn test
reports {
xml.enabled true
csv.enabled true
}
}
- 3.To ensure that you run JaCoCo, we recommend adding
finalizedBy jacocoTestReport
to your test configuration, for example:
test {
finalizedBy jacocoTestReport
}
You may also want/need to download an appropriate version of JaCoCo (0.8.3+) for use with your Cover projects as well.
- 1.Add the JaCoCo plugin to your build script (
build.gradle
orbuild.gradle.kts
):
plugins {
jacoco
}
- 2.Include the following configuration to enable the generation of the XML reports:
tasks {
jacocoTestReport {
dependsOn(test)
reports {
xml.required.set(true)
csv.required.set(true)
}
}
}
- 3.To ensure that you run JaCoCo, we recommend adding
finalizedBy jacocoTestReport
to your test configuration, for example:
test {
finalizedBy jacocoTestReport
}
You may also want/need to download an appropriate version of JaCoCo (0.8.3+) for use with your Cover projects as well.
Last modified 8d ago