Tested on Java LTS versions from 8 to 21.
Tested on Gradle versions from 6.0 to 8.12.
Usage:
plugins {
id 'name.remal.finalize-by-jacoco' version '1.0.5'
}
By default, Gradle doesn't make Jacoco tasks executed automatically. This plugin fixes this.
This plugin applies jacoco
plugin and then
makes Test
task finalized
by corresponding JacocoReport
and JacocoCoverageVerification
tasks.
Also, JacocoReport
and JacocoCoverageVerification
become depend on the corresponding Test
task.
Example:
test
is finalized byjacocoTestReport
andjacocoTestCoverageVerification
tasks- if a user executes
jacocoTestReport
task,test
will also be executed - if a user executes
jacocoTestCoverageVerification
task,test
will also be executed
Additional test source sets are also supported.
See
jvm-test-suite
,
name.remal.test-source-sets
,
and similar plugins.
Example:
testing.suites {
test {
useJUnitJupiter()
}
integrationTest(JvmTestSuite) {
}
}
integrationTest
is finalized byjacocoIntegrationTestReport
andjacocoIntegrationTestCoverageVerification
tasks- if a user executes
jacocoIntegrationTestReport
task,integrationTest
will also be executed - if a user executes
jacocoIntegrationTestCoverageVerification
task,integrationTest
will also be executed
If a task has JacocoTaskExtension
extension,
Jacoco tasks that work with the same Jacoco execution data file will be matched.
If a Jacoco task works with multiple execution files, it won't be matched.