Unable to execute SonarScanner analysis in Command Prompt

  • Bitbucket Cloud
  • Team City
  • mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey.
  • Java

I am getting following error when execute above maven command in a Command Prompt:

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project xxxx: Unable to execute SonarScanner analysis: Fail to get bootstrap index from server: Failed to connect to localhost/127.0.0.1:9000: Connection refused: connect ->

I do not experience this issue for my other Projects.
Any hint what to look at.

Hi,

The error itself is the best pointer:

Now the question is: why is it trying to connect to localhost/127.0.0.1:9000 rather than to sonarcloud.io? Among the mandatory analysis parameters is sonar.host.url, which tells analysis where to look for the server. Absent a URL value, it defaults to localhost, which is what happened here.

So you need to add -Dsonar.host.url=https://sonarcloud.io to your analysis commandline, or define the key/value pair somewhere else. Note that the SonarScanner for Maven docs list a few other parameters you’ll want to make sure are set as well.

Your other projects must have the required values set somewhere else - perhaps in their pom files.

 
HTH,
Ann

Thanks for provided information, the root cause was that the Pom-file was overwritten so Sonar Cloud URL was no longer available…
Issues is solved.

1 Like

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