Pre-processing Failure: Unable to Fetch SonarQube Version for SonarScanner

I am trying to run sonar scanner to produce sonar report LOCALLY.
SonarQube version 10.0.0.68432 and sonar scanner 4.8.0.2856 (java 17 and .net5)
So sonar qube up and running on http://localhost:9000 and once I execute the following command
dotnet PATH_TO\SonarScanner.MSBuild.dll begin /k:"ProjectName" /d:sonar.host.url=http://localhost:9000 /d:sonar.cs.opencover.reportsPaths=".\ProjectUnitTest\coverage.opencover.xml" /d:sonar.coverage.exclusions="ProjectUnitTest/**,**/*Test.cs" /v:1.0 /d:sonar.token="my-token" /d:sonar.verbose=true

I get

SonarScanner for MSBuild 5.13
Using the .NET Core version of the Scanner for MSBuild
Default properties file was found at PATH_TO\sonar-scanner-windows\SonarQube.Analysis.xml
Loading analysis properties from PATH_TO\sonar-scanner-windows\SonarQube.Analysis.xml
sonar.verbose=true was specified - setting the log verbosity to 'Debug'
Pre-processing started.
Preparing working directories...
Using environment variables to determine the download directory...
01:38:54.065  01:38:54.058  Loading analysis properties from PATH_TO\sonar-scanner-windows\SonarQube.Analysis.xml
01:38:54.067  01:38:54.065  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
01:38:54.073  Updating build integration targets...
01:38:54.076  The file SonarQube.Integration.ImportBefore.targets is up to date at HOME\AppData\Local\Microsoft\MSBuild\4.0\Microsoft.Common.targets\ImportBefore
01:38:54.077  The file SonarQube.Integration.ImportBefore.targets is up to date at HOME\AppData\Local\Microsoft\MSBuild\10.0\Microsoft.Common.targets\ImportBefore
01:38:54.077  The file SonarQube.Integration.ImportBefore.targets is up to date at HOME\AppData\Local\Microsoft\MSBuild\11.0\Microsoft.Common.targets\ImportBefore
01:38:54.078  The file SonarQube.Integration.ImportBefore.targets is up to date at HOME\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore
01:38:54.079  The file SonarQube.Integration.ImportBefore.targets is up to date at HOME\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore
01:38:54.079  The file SonarQube.Integration.ImportBefore.targets is up to date at HOME\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore
01:38:54.08  The file SonarQube.Integration.ImportBefore.targets is up to date at HOME\AppData\Local\Microsoft\MSBuild\Current\Microsoft.Common.targets\ImportBefore
01:38:54.083  Installed SonarQube.Integration.targets to HOME\workspace\libs\qa_log_lib\.sonarqube\bin\targets
01:38:54.084  Creating config and output folders...
01:38:54.085  Creating directory: ...\.sonarqube\conf
01:38:54.086  Creating directory: ...\.sonarqube\out
01:38:54.102  Fetching server version...
01:38:54.104  Downloading from http://localhost:9000/api/server/version...
01:38:54.265  Response received from http://localhost:9000/api/server/version...
01:38:54.267  Downloading from http://localhost:9000/api/server/version failed. Http status code is Forbidden.
01:38:54.268  An error occured while querying the server version! Please check if the server is running and if the address is correct.
01:38:54.269  Pre-processing failed. Exit code: 1

What is frustrating me is when I go to http://localhost:9000/api/server/version I get 10.0.0.68432

I am not doing something advanced here. Just want to scan my project locally and generate sonar report.

in sonar.properties I have updated the following:

sonar.web.host=localhost
sonar.web.port=9000

in SonarQube.Analysis.xml

  <Property Name="sonar.host.url">http://localhost:9000</Property>
  <Property Name="sonar.login">admin</Property>
  <Property Name="sonar.password">****</Property>
  <Property Name="sonar.token">****</Property>

and sonar-scanner.properties

sonar.host.url=http://localhost:9000

as I am using the admin account - locally - so I just updated the user to be able to run analysis

Any help is more than welcome.

I am working behind a Proxy. even though it has nothing to do with making a call locally, the no proxy data must be declared.
By creating a env var called
NO_PROXY=127.0.0.1,localhost
everything is back to normal.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.