Configured SonarQube properties in gradle.properties files for my spring boot project and SonarQube analysis is working fine(able to verify in portal). But when it tried to add some more property in build.gradle, it is not reflecting in sonar portal .
For exmaple in build.gradle added these sonar property , which is not reflecting in sonar portal–>
id 'org.springframework.boot' version '2.2.7.RELEASE'
id 'gradle-boost' version '2.1.0'
id 'org.sonarqube' version '2.7'
property "sonar.projectName", "MyprojectName"
property "sonar.projectDescription", "MyprojectDescription"
Properties in gradle.properties file
# Sonar Configuration
It’s not clear to me which properties aren’t working.
That said, project key isn’t something you should set in a global file; that should only be set at the project level or even on the analysis command line.
I tired by setting all properties in build.gradle (file in root folder) which did’t worked.
When i moved all the properties setting to gradle.properties file it started working.
- Do we have any rule like some properties should be set only via gradle.properties or command line but not in build gradle. ?
- To be more specific the value “MyprojectName” in ["property “sonar.projectName”, “MyprojectName” ] build.gradle sonnar setting is not reflected in Sonar UI(version:sonarqube-18.104.22.168397). Default project name value is displayed in UI.
I’m not aware of any rules for Gradle or any of the other scanners about what can’t be set in the global file. Only what shouldn’t.
Alright. I am going with this sonar docs and it works.
But its still grey area ,why if we move the sonar settings from gradle.properties to build.gradle it does’t worked?.
Thanks Ann ,much appreciated for your time.
I really think that’s going to end up being a Gradle thing & I don’t have the background there to help.