You’re still running analysis on each subproject individually. You want the gradle task (sonar) applied at the root of the hierarchy, and it should run exactly once. Just like in my example from earlier:
// Configure SonarQube once at root level
sonar {
properties {
property "sonar.host.url", "https://sonar.sai.com"
property "sonar.projectKey", "sai.qgt.app-gradle"
property "sonar.projectName", "sai-qgt.app-gradle"
property "sonar.token", "sai_12345672abcdef50a62"
}
}
// Programmatically skip projects without sources
subprojects { subproject ->
def javaSrcDir = new File(subproject.projectDir, "src/main/java")
def testSrcDir = new File(subproject.projectDir, "src/test/java")
def hasSources = javaSrcDir.exists() || testSrcDir.exists()
if (!hasSources || subproject.name == 'bom') {
subproject.sonar {
skipProject = true
}
}
}