# Kotlin DSL SQ Multi Module using gradle plugin 3.3

**URL:** <https://community.sonarsource.com/t/kotlin-dsl-sq-multi-module-using-gradle-plugin-3-3/49526>\
**Category:** SonarQube Server / Community Build\
**Tags:** gradle, kotlin, sonarqube\
**Created:** [September 9, 2021, 4:01pm UTC](https://community.sonarsource.com/t/kotlin-dsl-sq-multi-module-using-gradle-plugin-3-3/49526 "2021-09-09T16:01:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Riad\_Gaffar](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/riad_gaffar/32/17169_2.png) [@Riad\_Gaffar](https://community.sonarsource.com/u/Riad_Gaffar)\
**Post date:** [September 9, 2021, 4:01pm UTC](https://community.sonarsource.com/t/kotlin-dsl-sq-multi-module-using-gradle-plugin-3-3/49526/1 "2021-09-09T16:01:12Z")

</div>

Hi,  
I have a multi-module/project environment in which I am trying to post coverage for all modules. My issue is I see report for only one module, seems like it is getting over-written. I tried to replicate the instructions [here](https://community.sonarsource.com/t/change-module-directory-path-on-sonarqubeui/568/5) to establish the directory structure but it’s not working. I am also using a Modules.json for project structure but sonarqube is not reflecting the directory structure. Has anyone else experienced similar issues?

---

<div class="post-metadata">

**Author:** ![Alexandre\_Gigleux](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/alexandre_gigleux/32/26_2.png) [@Alexandre\_Gigleux](https://community.sonarsource.com/u/Alexandre_Gigleux)\
**Post date:** [September 10, 2021, 7:43am UTC](https://community.sonarsource.com/t/kotlin-dsl-sq-multi-module-using-gradle-plugin-3-3/49526/2 "2021-09-10T07:43:18Z")

</div>

Hello,

I’m not sure I can help for your topic about loading the coverage but I believe it’s important to have in mind that the concept of modules no longer exists in SonarQube since [https://jira.sonarsource.com/browse/MMF-365](https://jira.sonarsource.com/browse/MMF-365) was implemented.  
I would suggest to drop any config your tried to do in the past and just scan your code with [Gradle](https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-gradle/). Then the question will be: do you see already all the files / directories of your project in SonarQube?

Once this is confirmed and OK, you should configure this property:

`sonar.coverage.jacoco.xmlReportPaths`

… which accepts wildcards configuration.

`Path to JaCoCo XML coverage reports. Path wildcards are supported (see above).`

Would you mind also share some context: which version of SonarQube is used?

Alex

---

<div class="post-metadata">

**Author:** ![Riad\_Gaffar](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/riad_gaffar/32/17169_2.png) [@Riad\_Gaffar](https://community.sonarsource.com/u/Riad_Gaffar)\
**Post date:** [September 11, 2021, 3:40am UTC](https://community.sonarsource.com/t/kotlin-dsl-sq-multi-module-using-gradle-plugin-3-3/49526/3 "2021-09-11T03:40:32Z")

</div>

Hello,

Thanks for responding. I am using an older version of sonarqube, 7.9.1. I have a nested multi-module android/kotlin project where coverage reports for individual projects/subproject are generated gracefully using jacoco plugin/tasks. I am trying to integrate sonarqube for coverage report for all subprojects using the plugin. Following code iterates through all the projects but only the last project scanned appears in the sonar web UI.

```auto

fun Project.configureSonarqube() {
    apply {
        plugin("org.sonarqube")
        plugin("jacoco")
    }
    val defaultExcludes = listOf(
            "*.json",
            "*.xml",
            "*.html",
            " **/assets/**",
            " **/*Test*/**",
            " **/res/**",
    )
    val xmlReport = when {
        directoryExists("buildDir/reports/jacoco/testDeveloperReleaseUnitTestCoverage") -> {
            "$buildDir/reports/jacoco/testDeveloperReleaseUnitTestCoverage/testDeveloperReleaseUnitTestCoverage.xml"
        }
        else -> {
            "$buildDir/reports/jacoco/testReleaseUnitTestCoverage/testReleaseUnitTestCoverage.xml"
        }
    }

    val binaries = when {
        directoryExists("$buildDir/intermediates/javac/developerRelease") -> {
            "$buildDir/intermediates/javac/developerRelease/classes"
        }
        else -> {
            "$buildDir/intermediates/javac/release/classes"
        }
    }
    tasks.named("sonarqube").configure {
        allprojects {
            sonarqube {
                properties {
                    property("sonar.java.coveragePlugin", "jacoco")
                    property("sonar.exclusions", "$defaultExcludes")
                    property("sonar.coverage.jacoco.xmlReportPaths", "$xmlReport")
                    property("sonar.java.binaries", "$binaries")
                    property("sonar.cpd.exclusions", "**")
                }
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![mochadwi](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mochadwi/32/8389_2.png) [@mochadwi](https://community.sonarsource.com/u/mochadwi)\
**Post date:** [December 5, 2021, 10:50am UTC](https://community.sonarsource.com/t/kotlin-dsl-sq-multi-module-using-gradle-plugin-3-3/49526/4 "2021-12-05T10:50:41Z")

</div>

Where did you call `configureSonarqube` extension method?
