Problem running sonarqube on multi-module project with gradle

gradle

(coderaptor) #1

I am trying to analyze a multi-module project that builds with gradle. The project structure is something like this:
modules/m1/src/com/foo/m1
modules/m1/build/classes/java/com/foo/m1
modules/m2/src/com/foo/m2
modules/m2/build/classes/java/com/foo/m2

And so on. I have my build.gradle under modules/ (top level directory), where I have included the sonar properties, etc. Gradle build environment is fully functional. When I trigger a “gradle sonarqube” from modules/, it complains “Please provide compiled classes of your project with sonar.java.binaries property”. However, according to https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle, it should use ${sourceSets.main.output.classesDir} as default, which doesn’t seem to be happening.

This build environment is CentOS 6.x, gradle plugin version is 2.6.2, gradle version is 4.7.

What am I missing?


(Julien Henry) #3

Hi,

Could you please run gradle sonarqube -Dsonar.scanner.dumpToFile=sonar.properties and look at the content of the produced file. It should contains all properties collected by the scanner for Gradle. Look if sonar.java.binaries is missing for some modules.

If you prefer, you can also send the file to me (be careful, it may contains sensitive data, like sonar.login/sonar.password).

++