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.
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.