Unable to execute SonarScanner analysis: Fail to get bootstrap index from server: Host is unreachable(Host unreachable)

王又又的锅發表於2024-05-06

1.背景

編輯gitlab-ci流水線時,程式碼分析的job,maven使用sonar報錯
- mvn clean verify sonar:sonar -Dsonar.login=30c55d3b8d3d2569431fb39f3c488c90643a6844

2.錯誤資訊

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922:sonar (default-cli) on project test: Unable to execute SonarScanner analysis: Fail to get bootstrap index from server: Host is unreachable (Host unreachable) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

3.排查過程及解決

排查:
開始以為是scanner的版本問題,指定了scanner的版本,不行
後透過官方文件排查maven配置,發現sonar.host.url中的地址打錯了
image
解決:修改setting.xml重新制作maven基礎映象,啟動流水線執行成功

參考:
sonarqube文件:
https://docs.sonarsource.com/sonarqube/8.9/analyzing-source-code/scanners/sonarscanner-for-maven/
其他:
https://blog.csdn.net/q54244125/article/details/83866089

相關文章