Continuing the discussion from Sonar plugin 4.3.0.3225 error:
I have updated the Gradle SonarQube plugin from 4.0.0.2929 to 4.4.0.3356 and stumbled on the “can’t be indexed twice” problem for my build.gradle.kts files.
I should add that I don’t find any helpful details on this matter from the samples at GitHub - SonarSource/sonar-scanning-examples: Shows how to use the Scanners
My layout looks like this:
"Project root folder"
| |-- Module A
| | src
| | build.gradle.kts
| `-- Module B
| | src
| | build.gradle.kts
build.gradle.kts
Obviously I want SonarQube to analyze my build.gradle.kts files but not include them in code coverage calculations
Currently my config looks something like this (some details omitted for clarity):
Root project:
sonar {
properties {
property("sonar.projectKey", "com.mycompany:myproduct")
property("sonar.sourceEncoding", "UTF-8")
property("sonar.qualitygate.wait", "true")
}
}
Subprojects:
sonar {
properties {
property("sonar.exclusions", "**/BuildConfig.class,**/R.java,**/R\$*.java,src/main/gen/**/*")
property("sonar.sources", "src/main,build.gradle.kts")
property("sonar.tests", "src/test")
property("sonar.coverage.exclusions", "**/testapp/**/*")
property(
"sonar.coverage.jacoco.xmlReportPaths",
"${buildDir}/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"
)
property("sonar.junit.reportPaths", "${buildDir}/test-results/")
property("sonar.androidLint.reportPaths", "${buildDir}/reports/lint-results-debug.xml")
}
}