apply plugin: "io.gitlab.arturbosch.detekt" detekt { toolVersion = "$detekt_version" def projectPaths = subprojects.collect { def projectName = it.name if (it.subprojects.isEmpty()) { "$projectDir/$projectName/src/main/java" } else { it.subprojects.collect { sub -> "$sub.projectDir//src/main/java" } } }.flatten() source = files(*projectPaths) config = files("$projectDir/detekt/detekt.yml") baseline = file("$projectDir/detekt/baseline.xml") } tasks.getByName("detekt") { reports { txt.required.set(true) txt.outputLocation.set(file("build/reports/detekt.txt")) html.required.set(true) html.outputLocation.set(file("build/reports/detekt.html")) xml.required.set(false) sarif.required.set(false) } }