SonarQube: Fail to get bootstrap index from server: Status returned by url [http://hostname:9095/sonar/batch/index] is not valid: [403]

匿名 (未验证) 提交于 2019-12-03 01:33:01

问题:

I am trying to execute following maven command from 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 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 am trying to access http://hostname:9095 in browser it works.

I have also set the base url in sonarqube settings to http://hostname:9095 and tried but its fails with same error.

Sonaqube is installed on same machine as maven and jenkins.

I thought it may be due to proxy(may be I am wrong), So I have set proxy settings in sonar.properties file and tried but no luck.

FYI, It is using following version of sonar-maven plugin,

[INFO] --- sonar-maven-plugin:3.3.0.603:sonar (default-cli) @ my-stc --- 

Anyone faced same issue earlier ?

回答1:

The issue was with sonar-maven plugin version 3.3 I tried with version 3.2 and it worked. I passed following to maven command line arguments org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar



回答2:

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.



回答3:

Upgrade to solve sonar version issue.

org.apache.maven.plugins maven-compiler-plugin 3.5.1



回答4:

This issue exists in org.sonarsource.scanner.maven.sonar-maven-plugin 3.5.0 plugin as well.

Upgrade your POM dependency to use a new Version or some earlier version like 3.2 are also stable.

org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar 


回答5:

I think it's giving you the error because the program can't hit the endpoint you specified.

You shouldn't be specifying the 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 -Dsonar.host.url flag should be: -Dsonar.host.url=http://sonar.yourcompany.com

You don't need the /sonar at the end of http://sonar.yourcompany.com

Also, sonar runs on port 9000, not 9095.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!