I have a multi-module project and using jacoco get a code coverage report across all subprojects.
Theres the task
task codeCoverageReport(type: JacocoReport) {
dependsOn = subprojects.test
// Gather execution data from all subprojects
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
additionalSourceDirs.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories.setFrom files(subprojects.sourceSets.main.output).collect {
fileTree(dir: it, exclude: coverageExcludedClassDirectories)
}
...
}
but when calling .gradlew build I get the error Could not get unknown property 'test' for project ':project-name' of type org.gradle.api.Project.
even though there are tests defined. Without the dependency on the test the build still errors saying it cannot find the property ‘sourceSets’.
What can I do for the build to find the subproject properties?