libs.versions.toml:
[versions]
sonarVersion = "6.2.0.5505"
[plugins]
sonarPlugin = { id = "org.sonarqube", version.ref = "sonarVersion" }
project-level build.gradle.kts:
import org.sonarqube.gradle.SonarExtension
plugins {
alias(libs.plugins.sonarPlugin) apply false
}
subprojects {
plugins.withId(rootProject.libs.plugins.sonarPlugin.get().pluginId) {
configure<SonarExtension> {
properties {
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.projectKey", "projectKey")
property("sonar.projectName", "projectName")
property("sonar.organization", "organization")
property(
"sonar.coverage.jacoco.xmlReportPaths",
"${project.rootDir}/build/reports/jacoco/jacocoAggregatedReport/jacocoAggregatedReport.xml"
)
}
}
}
}
Now, I simply apply the plugin to the three modules which I want to analyze:
plugins {
alias(libs.plugins.sonarPlugin) // this is applied to two other modules
}
Then I run sonar from the terminal:
./gradlew sonar -Dsonar.token=my-sonar-token
I do see sonar executing for the three modules one at a time. But in the end, I only see data related to the last module for which the sonar gradle task was executed. So, for example, if the three modules I had were: moduleA, moduleB, and moduleC, I only see the sonar analysis for moduleC because that was the last module for which the sonar task was executed. Is there something wrong with how I am using sonar here?