SonarQube: Failed to get bootstrap index from server: status returned by url [http: // hostname: 9095 / sonar / package / index] is not valid: [403]
I am trying to execute the following maven command from a jenkins job, mvn clean install sonar:sonar -Dsonar.host.url=http://hostname:9095/sonar -Dsonar.projectKey=mavensample -Dsonar.login=admin -Dsonar.password=admin -X
But it fails with the following error,
[DEBUG] 18:20:49.119 Download: http://hostname:9095/batch/index
[ERROR] 18:20:49.176 SonarQube server [http://hostname:9095] can not be reached
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.920 s
[INFO] Finished at: 2017-07-14T18:20:49+02:00
[INFO] Final Memory: 20M/171M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project my-stc: Unable to execute SonarQube: Fail to get bootstrap index from server: Status returned by url [http://hostname:9095/batch/index] is not valid: [403] -> [Help 1]
When I try to access http: // hostname: 9095 in the browser it works.
I also set the base url in sonarqube settings to http: // hostname: 9095 and tried it but it doesn't work with the same error.
Sonaqube is installed on the same machine as Maven and Jenkins.
I thought it might be proxy related (maybe I'm wrong), so I set the proxy parameters in my sonar.properties file and tried but no luck.
For your information, the following version of the sonar-maven plugin is used,
[INFO] --- sonar-maven-plugin:3.3.0.603:sonar (default-cli) @ my-stc ---
Has anyone faced the same problem before?
source to share
Try using sonar-maven-plugin version 3.2 in your pom.xml
pom.xml
<properties>
<sonar.host.url>http://xxxxx:9000</sonar.host.url>
<sonar.login>be2fe3y27f07db354983dfxysdsa5256</sonar.login>
<sonar.language>java</sonar.language>
<sonar.scm.provider>git</sonar.scm.provider>
</properties>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.2</version>
</plugin>
This works for me.
source to share
I think this is giving you an error because the program cannot reach the endpoint you specified.
You do not need to specify a port if the URL already has a DNS mapping. For example if http://sonar.yourcompany.com is already mapped to 123.23.22.10:9000
So your flag -Dsonar.host.url should be: -Dsonar.host.url = http://sonar.yourcompany.com
You don't need / sonar at the end of http://sonar.yourcompany.com
Also, sonar operates on port 9000 rather than 9095.
source to share
We had the same problem. In our case Jenkins and SonarQube were running on the same machine behind a reverse proxy. This solved our problem after updating the host url to http: // localhost: 9000 .
source to share