Hello Team, I was running sonarscan for gradle r...
# community-support
v
Hello Team, I was running sonarscan for gradle related projects, that was multi-project... So inside app folder there will be multiple modules . in the root level we have one build,gradle and settings.gradle . Have implemented sonar plugin and properties in the build.gradle file.
Copy code
plugins {
    // Declare the SonarQube plugin here but don't apply it automatically.
    // This makes the plugin available to all subprojects using the same version,
    // while allowing us to selectively apply it only to relevant modules (e.g., exclude 'bom' or root).
    id 'org.sonarqube' version '7.0.1.6134' apply false
}

subprojects {
    if (project.name != 'bom') {
        apply plugin: 'java-library'
        apply plugin: 'maven-publish'
        apply plugin: 'jacoco'
        apply plugin: 'org.sonarqube'

        afterEvaluate {
            if (project.name == "sai" || project.name == "sai1" || project.name == "sai2") {
                // Skip SonarQube analysis for these projects
                sonar {
                    skipProject = true
                }
            } else {
                // Apply SonarQube properties for other projects
                sonar {
                    properties {
                        property "sonar.host.url", "<https://sonar.sai.com>"
                        property "sonar.projectKey", "sai.eas.app-gradle"
                        property "sonar.projectName", "sai-eas.app-gradle"
                        property "sonar.token", "sai_faefefibbvkbrkbrbkbbvrkb123456"
                        property "sonar.sources", "src/main/java"
                        property "sonar.tests", "src/test/java"
                        // Add other required properties here
                    }
                }
            }
        }
    }
}

While running in local at first it analyzed and publish the reports to sonarqube server(Not for all componenets just 1 or 2 ). inside modules there will be submodules. If a particular module doesn't contain say for example src/tst/java the sonarscan should skip and go for next module ...in my case it was failing right after that stage. I was using the command "gradle sonar --info"
v
Besides your various bad-practices in this snippet, this seems to be more a question how to use / configure the SonarQube plugin properly, so maybe you better ask this in the SonarQube community or their support if you are a paying customer?