Configure a multi module the right way

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 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. 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

Hey there.

If you’re building with Gradle, you should really use the SonarScanner for Gradle, which should handle all this configuration for you. :slight_smile:

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

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, including a section on Jenkins. Have you tried this route?