Modifiez build.gradle du projet racine comme suit
allprojects {
apply plugin: 'java'
apply plugin: 'jacoco'
repositories {
jcenter()
}
jacoco {
toolVersion = '0.7.9'
}
}
subprojects {
test {
reports.html.enabled = false
}
jacocoTestReport {
additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
}
}
task testRootReport(type: TestReport) {
destinationDir = file("$buildDir/reports/allTests")
reportOn subprojects.tasks.test
}
task jacocoRootReport(type: JacocoReport) {
dependsOn = subprojects.test
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.sourceSets.main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
}
task report(dependsOn: ['testRootReport', 'jacocoRootReport'])
commander
./gradlew test report
résultat
.
└── build
└── reports
├── allTests
│ └── index.html etc...
└── jacoco
└── jacocoRootReport
└── html
└── index.html etc...
référence
https://gist.github.com/aalmiray/e6f54aa4b3803be0bcac http://clash-m45.hatenablog.com/entry/2015/01/24/162621
Recommended Posts