Hi,
JAVA isn’t much used here, but few projects we have using it, so I set up SonarQube now also for one of these projects using gradle.
- I set up the project in sonarqube as usual, with the correct project name
- I added relevant build steps (using DevOps extension in version 4 [I know is older, but this devops is customer managed]) for prepare, gradle build and publish and set up connections etc
Result:
The project is correctly analyzed, but the run changed the project name in SonarQube to “s”, which isn’t very helpful. Since there is no way to change the name, except with a new analysis upload, thats bad.
I assume the name “s” is, because the build agent checks the project out into a folder called “s” automatically. I can not influence this folder name.
Steps I tried without success:
- I added explicit project name in gradle options:
- task: Gradle@2
inputs:
gradleWrapperFile: $(gradleWrapperPath)
tasks: 'build'
gradleOptions: '-Dorg.gradle.daemon=false -Xmx2048m -Dsonar.projectName=CUSTOMER_ProjectName'
options: '--debug'
javaHomeOption: 'JDKVersion'
sonarQubeRunAnalysis: true
- I checked the debug output, and actually it looks like the project name is correctly sent to sonarQube:
2022-06-08T10:17:27.7491723Z 2022-06-08T12:17:27.719+0200 [DEBUG] [org.sonarqube.gradle.SonarQubeTask] POST 200 https://sonarqube.......com/api/ce/submit?projectKey=xxxxxxxxxxx&projectName=CUSTOMER_ProjectName&characteristic=branch%3Drkg_fix_sonarqube&characteristic=branchType%3DBRANCH | time=1350ms
But the project name is unchanged. This query is for a branch analysis, but neither the master nor the branch name is adapted correctly, also, the only change in this branch is enabling the debug mode.
I am clueless whats going on here. I don’t have any issues with C# or JS/TS projects in the same or other devops projects, only this gradle project.
Any ideas?