无法在gradle项目中使用gitlab CI访问SonarQube服务器

时间:2019-07-25 05:49:04

标签: gradle sonarqube gitlab-ci

使用gitlab CI,无法到达sonarqube服务器。

我已打开端口9000上的防火墙,但无法解决问题。还可以尝试用IP地址替换“ localhost”

gitlab ci的yml文件-

variables:
 SONAR_URL: "http://localhost:9000"
 SONAR_LOGIN: "admin"
 SONAR_PASSWORD: "admin"

image: gradle:latest

build:
 stage: build
 script:
  - bash ./gradlew sonarqube -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.password=$SONAR_PASSWORD
 only:
  - master

Gradle的输出:

Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileJava
> Task :compileGroovy NO-SOURCE
> Task :processResources NO-SOURCE
> Task :classes
> Task :compileTestJava
> Task :compileTestGroovy NO-SOURCE
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test

> Task :sonarqube FAILED
SonarQube server [http://localhost:9000] can not be reached

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sonarqube'.
> Unable to execute SonarQube

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 28s
4 actionable tasks: 4 executed

0 个答案:

没有答案