2016-07-06 69 views
0

我使用jenkins,我需要我的sonarqube對我的代碼進行一些分析。使用jenkins時未能找到sonarqube

我使用docker來管理兩個圖像並映射端口,以便它們可以從外部訪問。它工作得很好,我可以在兩個門戶中打開並登錄。

我的問題是,當我嘗試運行我的詹金斯建設,並要求sonarqube的信息,它拋出我下面的錯誤:

ERROR: Error during SonarQube Scanner execution 
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube 
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84) 
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71) 
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67) 
    at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218) 
    at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156) 
    at org.sonarsource.scanner.cli.Main.execute(Main.java:70) 
    at org.sonarsource.scanner.cli.Main.main(Main.java:60) 
Caused by: java.lang.IllegalStateException: Fail to download libraries from server 
    at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:93) 
    at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70) 
    at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39) 
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75) 
    ... 8 more 
Caused by: java.net.ConnectException: Connection refused 
    at java.net.PlainSocketImpl.socketConnect(Native Method) 
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) 
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) 
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) 
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 
    at java.net.Socket.connect(Socket.java:589) 
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.Platform.connectSocket(Platform.java:101) 
    at org.sonarsource.scanner.api.internal.shaded.okhttp.Connection.connectSocket(Connection.java:198) 
    at org.sonarsource.scanner.api.internal.shaded.okhttp.Connection.connect(Connection.java:172) 
    at org.sonarsource.scanner.api.internal.shaded.okhttp.Connection.connectAndSetOwner(Connection.java:358) 
    at org.sonarsource.scanner.api.internal.shaded.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:117) 
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:329) 
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:246) 
    at org.sonarsource.scanner.api.internal.shaded.okhttp.Call.getResponse(Call.java:276) 
    at org.sonarsource.scanner.api.internal.shaded.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:234) 
    at org.sonarsource.scanner.api.internal.shaded.okhttp.Call.getResponseWithInterceptorChain(Call.java:196) 
    at org.sonarsource.scanner.api.internal.shaded.okhttp.Call.execute(Call.java:79) 
    at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:114) 
    at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:99) 
    at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:78) 
    ... 11 more 
ERROR: 
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging. 
Build step 'Execute SonarQube Scanner' marked build as failure 
Finished: FAILURE 

我不知道都發生了什麼事情錯在這裏。

我所做的:

  • 我已經註冊的服務器密鑰「用戶=>標記=>生成用戶令牌」在sonarqube,並用它我詹金斯應用
+0

它可能正在使用目前爲Docker映射的其他端口下載堆棧跟蹤中提到的庫。 – Joakim

+0

有沒有人找到任何解決方案? –

回答

0

此錯誤表示您的Jenkins服務器無法訪問您的聲納服務器。也許IP或域名設置錯誤。也許他們之間的網絡設置不正確。

在詹金斯控制檯

某處登陸,你應該看到這樣的事情:

Injecting SonarQube environment variables using the configuration: Sonarqube Local 
[workspace] $ mvn sonar:sonar -Dsonar.host.url=http://sonar.yourserver.com -Dsonar.login=****** 

確保此sonar.host.url設置正確。然後確保你可以從你的jenkins服務器訪問它。