0
votes

I am using Jenkins job to build .Net project. I have added sonar analysis.

D:\Temp\tools\Scanner_MSBuild-2.2\MSBuild.SonarQube.Runner.exe begin /k:myproj /n:myproj-full /v:1.0.0 /s:D:\Temp\SonarQube.Analysis.xml

I have updated "SonarQube.Analysis.xml" with required sonar url and login credentials. But it fails with following error:

Pre-processing started. Preparing working directories... SonarQube Scanner for MSBuild 2.2 09:07:00.437 Updating build integration targets... 09:07:00.451 Fetching analysis configuration settings... 09:07:01.239 Could not find a file on the SonarQube server. URL: https:///api/qualityprofiles/search?defaults=true 09:07:01.239 Pre-processing failed. Exit code: 1

I tried following:

D:\Temp\tools\Scanner_MSBuild-2.2\MSBuild.SonarQube.Runner.exe begin /k:myproj /n:myproj-full /v:1.0.0 /s:D:\Temp\SonarQube.Analysis.xml -Dsonar.buildbreaker.skip=true

But it threw error that -Dsonar.buildbreaker.skip=true is not recognised command. By default buildbreaker is set to false and I am not able to make it true via commandline. SonarQube version I am using is below 5.2.

How do I fix this?

Thank you

1
Are you using the Jenkins Begin Analysis and End Analysis build steps? - G. Ann - SonarSource Team
I was. It was also throwing error that "-Dsonar.buildbreaker.skip=true" is not recognised. Jenkins Begin Analysis plugin was automatically taking this parameter and was throwing error that Dsonar.buildbreaker.skip=true is not recognised. I think it is happening because Sonar version is below 5.2. Is there any way that through commandline, it can understand "Dsonar.buildbreaker.skip" option? - Raji

1 Answers

0
votes

If you're using the 'Begin Analysis' and 'End Analysis' build steps, then configuring your server URL in SonarQube.Analysis.xml won't get you far (as you've learned).

Instead, you need to configure the location of your server at the global level as described in the docs. Briefly:

  • Manage Jenkins > Configure System > SonarQube configuration
  • Add SonarQube
  • fill in your server info.

Then double check that that server instance is selected in your build steps (if you have only one server configured, build steps will default to it). And analyze.