Hi @SaveurDeLime ,
Welcome to SonarSource Community!
Are you really using SonarQube version : 3.2.0
? Can you confirm what version is listed at the bottom of the SonarQube UI. It should show your version number.
You almost have it correct. Take a look at my example of “gradle-multimodule-coverage” in sonar-scanning-examples repo. You will need to do a few modifications to have separate SonarQube projects analyzed within one large “mono-repo”-like Gradle project:
In root build.gradle:
- Remove/comment out the id ‘org.sonarqube’ version ‘3.0’ from plugins block
- Remove/comment out the subprojects block
- Remove/comment out the reference to sonar.gradle: apply from: “$project.rootDir/sonar.gradle”
In application/build.gradle:
- Add id ‘org.sonarqube’ version ‘3.0’ to plugins block
- Add this to the bottom of the file:
apply plugin: "org.sonarqube"
sonarqube {
properties {
// Insert other SonarQube properties here
property 'sonar.projectName', 'APP-ONLY'
property 'sonar.projectKey', 'APP-ONLY'
}
}
In list/build.gradle or utilities/build.gradle:
(do the same as I mentioned in application/build.gradle except change the sonar.projectName, sonar.projectKey, etc.)
From command line, to build and do sonar scan analysis, you can pick just the single module such “list” module to build and do Sonar analysis like so:
./gradlew clean :list:build :list:sonarqube -Dsonar.host.url=<INSERT-SONARQUBE-HOSTNAME> -Dsonar.login=<INSERT-USER-TOKEN>
Give that a try and let me know what you think.
By the way, this error you get is because you did not pass the sonar.login and/or sonar.password. For example, if you login with username and password you would pass it to your gradlew command like so:
./gradlew clean build codeCoverageReport -Dsonar.host.url=http://localhost:9000 -Dsonar.login=admin -Dsonar.password=password sonarqube
or if you are using a user token:
./gradlew clean build codeCoverageReport -Dsonar.host.url=http://localhost:9000 -Dsonar.login=cb7db4ed2541e198fa2ce4e4f299482fcc132c2 sonarqube
Please review User Tokens.
Joe