sfeir-open-source / sonar-clover

It provides the ability to feed SonarQube with code coverage data coming from Atlassian Clover
Apache License 2.0
15 stars 25 forks source link

Clover sensor not firing for groovy projects #44

Open prestontim opened 3 years ago

prestontim commented 3 years ago

This is not really a bug report, but I'm not sure where else to post my question...

I have been unable to figure out why one of my projects is not importing the Clover coverage into SonarQube EE (8.5.0).

I am setting the sonar.clover.reportPath property (see screenshot) and the file is present/valid. However, I am getting the following message when I run my (Gradle) SonarQube scan with debug-level logging: 'Clover Coverage Analysis' skipped because there is no related file in current project

So what am I missing? What files/properties are needed to make the Clover sensor fire?

I can provide logs, scanner context, etc., but I'm not sure what would be valuable at this point. Any assistance is appreciated.

image

prestontim commented 3 years ago

image

prestontim commented 3 years ago

Here are the relevant bits of Gradle sonarqube config from my build script (I'm using version 2.8 of the 'org.sonarqube' gradle plugin and have also tried 3.0 with the same results):

sonarqube {
    properties {
        property "sonar.projectKey", "********************"
        property "sonar.projectName", "********************"
        property "sonar.login", "********************"
        property "sonar.host.url", "********************"
        property "sonar.core.serverBaseURL", "********************"
        property "sonar.projectBaseDir", new File(".")
        property "sonar.clover.reportPath", file("$buildDir/reports/clover/clover.xml")

        def gitBranch = System.env["GIT_BRANCH"]
        def changeBranch = System.env["CHANGE_BRANCH"]
        def changeTarget = System.env["CHANGE_TARGET"]
        def changeKey = System.env["CHANGE_ID"]
        def isPullRequest = changeBranch && changeTarget && changeKey

        if (isPullRequest) {
            property "sonar.pullrequest.branch", changeBranch
            property "sonar.pullrequest.base", changeTarget
            property "sonar.pullrequest.key", changeKey
        } else {
            property "sonar.branch.name", gitBranch
        }
    }
}
prestontim commented 3 years ago

This seems to be related to Groovy projects only. Coverage on Java projects is being imported properly, so I'm going to close this ticket out.

Tony-Proum commented 3 years ago

Hi, I'm preparing a release of this bug fix, https://github.com/sfeir-open-source/sonar-clover/pull/45 and seems related to this issue. But testing the future 4.2 version of our plugin with sonarqube 8.9-community seems not to fix the bug. I have no report for groovy project image Maybe is there something missing for groovy projects ?

I reopen this issue to keep a track on what we are doing : but since the 4.2 release is focus on this bug fix, I think that we should fix it before releasing 😅