SonarQube: Fail to get bootstrap index from server: Status returned by url [http://hostname:9095/sonar/batch/index] is not valid: [403]
I've recently had a very similar problemFor me the resolution is to do with the proxy settings, if you don't have a proxy then skip this answer.
My command
mvn clean sonar:sonar -Dsonar.host.url=http://192.168.56.101:9000 -Dsonar.login=admin -Dsonar.password=admin
[INFO] --- sonar-maven-plugin:3.7.0.1746:sonar (default-cli) @ baselineV001-parent ---[INFO] User cache: /home/developer/.sonar/cache[ERROR] SonarQube server [http://192.168.56.101:9000] can not be reached[INFO] ------------------------------------------------------------------------[INFO] Reactor Summary for baselineV001-parent 1.0.0-SNAPSHOT:... skipping some info lines for brevity (its a big project)[INFO] ------------------------------------------------------------------------[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project baselineV001-parent: Unable to execute SonarQube: Fail to get bootstrap index from server: Status returned by url [http://192.168.56.101:9000/batch/index] is not valid: [503] -> [Help 1]
The key part of the log being http://192.168.56.101:9000/batch/index is not valid. I can curl this url and it works.
After a little thinking about what is different from curl, I have a proxy set in maven settings ~/.m2/settings.xml
but I dont have one set for curl.
To check if proxy is the issue I removed the proxy entry in my settings.xml and then I saw it working and communicating with my sonarqube server
So if you have a proxy, you probably want to specify your sonarqube server as a host in the field nonProxyHosts
in ~/.m2/settings.xml
<proxies> <proxy> <id>intranet-proxy</id> <active>true</active> <protocol>http</protocol> <username/> <password/> <host>proxy.intra.redacted.com</host> <port>8080</port> <nonProxyHosts>localhost|192.168.56.101</nonProxyHosts> </proxy> </proxies>
Also a small point about advising people to use v3.2. It might be a fix, but it shouldn't be the long term answer as v3.2 is currently 3 years old (4 years old come September 2020). I've seen in other threads the sonarsource support team says give us more information about this problem, but on a newer version of sonar-maven-plugin.
Edit 1:Forgot to say that I could not find a change in the v3.3.0.603 of sonar-maven-plugin at https://github.com/SonarSource/sonar-scanner-maven, but it seems that versions 3.3.0.603 to current (3.7.0.1746) and probably future versions pay attention to the maven settings for proxies.You could argue it was a bug in previous versions that they didn't honor maven's proxy settings.Edit 2: typo
Try to use 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.