0
votes

I am implementing sonarQube in one of my project.The source code is in java and all build files are written in gradle 2.3.My project is having 8 modules under same repository and I am using the gradle wrapper while building the module.I checked in gradle wrapper for each module with module source code.while I trigger the build it checkout the gradle version(mentioned in wrapper properties file) from the artifactoryand use gradlew to build the artifact.

Below is mentioned in the wrapper properties files

Tue Mar 17 10:20:49 EDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://xyx.n.tson.com\:9000/artifactory/ext-release-local/org/gradle/gradle/2.3/gradle-2.3-bin.zip

while it checkout it creates a wrapper/dist in workspace in below manner(Using Jenkins)

wrapper/dists/gradle-2.3-bin/7gkccujig8oqm5bun82efob8m7/gradle-2.3/init.d/

Now I want to implement the sonar and for that I need to create global sonar.properties file or better add a section for sonarRunner Gradle task (containing all the sonar.xx.xx properties) where I can keep all the configuration and use it globally . I don't want to write the properties for each module.Can someone tell me if I am using the gradle wrapper where I can keep this property file and make it global for all modules instead of changing or creating the property file for each module.

2
As officially announced by the Gradleware team (see twitter.com/gradle/status/613530568655966208), only the Gradle SonarQube plugin should be used to launch some SonarQube analysis from Gradle: docs.sonarqube.org/display/SONAR/Analyzing+with+GradleFreddy - SonarSource Team

2 Answers

0
votes

I would put this file somewhere near your rootproject instead of having it with the wrapper itself. I would put it under $rootproject/gradle/sonar/sonar.properties)

from your build script you can reference this file via

rootproject.file("gradle/sonar/sonar.properties")

cheers,

René

0
votes

If what you want is a non intrusive way to activate sonarqube plugin on your project (ie without doing a modification of build.gradle) then I have no idea of how to do that.

But if you want a way to pass properties configured in global Jenkins configuration (like server URL and credentials) to your build, then you should follow this ticket as this is a known limitation: http://jira.sonarsource.com/browse/SONARJNKNS-217