SonarQube Kotlin DSL

Versions:
SonarQube 7.9.1-Community
sonarqube-gradle-plugin:3.0

Hi everybody, I’m trying to setup JaCoCo & Sonarqube in an Android multi-module project, the project uses Kotlin Gradle DSL instead of the old Groovy. Due to that I’m facing a problem to setup the xmlReportPaths because I couldn’t find how to do this using Kotlin DSL

If I change my build.gradle to use Groovy and setup like the following it works and shows the coverage:

sonarqube {
        properties {
            property "sonar.coverage.jacoco.xmlReportPaths", "$buildDir/reports/jacoco/coverageReport/coverageReport.xml"
        }
    }

What I’ve tried so far but didn’t work:

        delegateClosureOf<org.sonarqube.gradle.SonarQubeExtension> {
        properties {
            property("sonar.coverage.jacoco.xmlReportPaths", "$buildDir/reports/jacoco/coverageReport/coverageReport.xml")
        }
    }

and also:

closureOf<org.sonarqube.gradle.SonarQubeExtension> {
        properties {
            property("sonar.coverage.jacoco.xmlReportPaths", "$buildDir/reports/jacoco/coverageReport/coverageReport.xml")
        }
    }

Welcome to the community @jhowcs!

Actually adding parentheses when calling property should be enough. Have you tried it like this:

sonarqube {
        properties {
            property("sonar.coverage.jacoco.xmlReportPaths", "$buildDir/reports/jacoco/coverageReport/coverageReport.xml")
        }
    } 

If this doesn’t help you, could you, please, provide a full build file or a link to the repository?

Regards,
Margarita

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.