# Configure a multi module the right way

**URL:** <https://community.sonarsource.com/t/configure-a-multi-module-the-right-way/84761>\
**Category:** SonarQube Server / Community Build\
**Tags:** multi-module\
**Created:** [February 24, 2023, 11:19pm UTC](https://community.sonarsource.com/t/configure-a-multi-module-the-right-way/84761 "2023-02-24T23:19:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![moley77](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@moley77](https://community.sonarsource.com/u/moley77)\
**Post date:** [February 24, 2023, 11:19pm UTC](https://community.sonarsource.com/t/configure-a-multi-module-the-right-way/84761/1 "2023-02-24T23:19:52Z")

</div>

Hallo everyone,

I have a multi module gradle project, different modules have different source folders available or even not (some have src/test/java or src/test/groovy, some have none).  
I am using for some projects the jenkins sonarscanner and must create a sonar-project.properties in this cases. My question is: How do I configure these differences properly? Is it OK to always configure all folders as source or testsource even as not all folders are available for all submodules or do I have to add another properties file on each modules level?

I didn’t find an example for this in the sonarqube documentation at [SonarScanner](https://docs.sonarqube.org/latest/analyzing-source-code/scanners/sonarscanner/). Maybe you could add handy examples or at least link me to examples existing at another place?

Would be really great.  
Thanks in advance and have a nice weekend

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [February 27, 2023, 9:40am UTC](https://community.sonarsource.com/t/configure-a-multi-module-the-right-way/84761/2 "2023-02-27T09:40:25Z")

</div>

Hey there.

If you’re building with Gradle, you should really use the [SonarScanner for Gradle](https://docs.sonarqube.org/latest/analyzing-source-code/scanners/sonarscanner-for-gradle/), which should handle all this configuration for you. 🙂

---

<div class="post-metadata">

**Author:** ![moley77](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@moley77](https://community.sonarsource.com/u/moley77)\
**Post date:** [February 27, 2023, 6:38pm UTC](https://community.sonarsource.com/t/configure-a-multi-module-the-right-way/84761/3 "2023-02-27T18:38:11Z")

</div>

Hi Colin,

I know, and in 80% of all cases we do. But we have builds which are still jdk8 (and we have builds which are jdk17, so we need to update) and as we are recieving an error because newer versions of sonarqube are jdk11 only I have to do the workaround to configure the projects with my gradle build and then call sonarqube with jenkins sonarscanner plugin and the jdk11… This workaround is working with the downside that I have to configure all stuff on my own.

Do you have another suggestion to workaround this situation completely with gradle, then I would be happy to hear about

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [February 28, 2023, 8:09am UTC](https://community.sonarsource.com/t/configure-a-multi-module-the-right-way/84761/4 "2023-02-28T08:09:11Z")

</div>

You should be able to swap the version of Java used between gradle commands (seperating `gradle build` and `gradle sonarqube`, for example)

This is discussed more in detail in the documentation on [Scanner Environment](https://docs.sonarqube.org/latest/analyzing-source-code/scanner-environment/), including a section on Jenkins. Have you tried this route?
