Expected Behavior
jacocoTestReport work
Current Behavior
jacocoTestReport SKIPPED
Context
I created a task whose type is Test, and jacocoTestReport depends on the task. When I ran the task, jacocoTestReport did not work and I got the following information
jacocoTestReport SKIPPED
I find if I use the task test
directly, jacocoTestReport worked fine. It makes me confused
the following code caused the above issue
plugins {
id 'java'
id 'jacoco'
}
repositories {
mavenCentral()
}
dependencies {
}
task myTest(type: Test) {
useTestNG()
useJUnitPlatform()
finalizedBy jacocoTestReport
reports {
junitXml.required = false
html.required = true
}
jacoco {
enabled = true
destinationFile = layout.buildDirectory.file("jacoco/${name}.exec").get().asFile
}
}
jacocoTestReport {
// tests are required to run before generating the report
dependsOn myTest
reports {
xml.required = false
csv.required = false
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
}
Steps to Reproduce
Your Environment
Gradle 7.1.1
Thanks
CodePudding user response:
It is expected, not an issue. just because I use the jacocoTestReport in a wrong way