2016-03-14 161 views
0

我想在我的構建過程中集成SonarQube跑步者。我的構建步驟包括一個螞蟻構建和聲納運行任務。我以後附上了截圖。我得到一個錯誤,指出「SonarQube與Jenkins的集成

無法確定數據庫方言與方言 空JDBC URL本地主機 構建步驟‘調用獨立SonarQube分析’標記建立爲故障

聲納中使用」 -

[MyProject] $ /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Default-SonarQube-Runner/bin/sonar-runner -X -e -Dsonar.jdbc.url=localhost ******** ******** -Dsonar.host.url=http://qa.MyProject.com:9000 ******** ******** -Dsonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject -Dproject.settings=/var/lib/jenkins/workspace/MyProject/sonar-project.properties 
SonarQube Runner 2.4 
Java 1.7.0_95 Oracle Corporation (64-bit) 
Linux 3.13.0-48-generic amd64 
INFO: Error stacktraces are turned on. 
INFO: Runner configuration file: /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Default-SonarQube-Runner/conf/sonar-runner.properties 
INFO: Project configuration file: /var/lib/jenkins/workspace/MyProject/sonar-project.properties 
INFO: Default locale: "en_US", source code encoding: "UTF-8" 
INFO: Work directory: /var/lib/jenkins/workspace/MyProject/.sonar 
INFO: SonarQube Server 5.1 
07:06:34.641 INFO - Load global repositories 
07:06:34.651 DEBUG - Download: http://qa.MyProject.com:9000/batch/global (no proxy) 
07:06:34.744 INFO - Load global repositories (done) | time=105ms 
07:06:34.745 INFO - Server id: 20160304110723 
07:06:34.747 INFO - User cache: /var/lib/jenkins/.sonar/cache 
07:06:34.755 INFO - Install plugins 
07:06:34.755 DEBUG - Download index of plugins 
07:06:34.755 DEBUG - Download: http://qa.MyProject.com:9000/deploy/plugins/index.txt (no proxy) 
07:06:34.841 DEBUG - Loaded 2196 properties from l10n bundles 
07:06:34.842 INFO - Install JDBC driver 
07:06:34.842 DEBUG - Download index of jdbc-driver 
07:06:34.842 DEBUG - Download: http://qa.MyProject.com:9000/deploy/jdbc-driver.txt (no proxy) 
INFO: ------------------------------------------------------------------------ 
INFO: EXECUTION FAILURE 
INFO: ------------------------------------------------------------------------ 
Total time: 0.681s 
Final Memory: 3M/59M 
INFO: ------------------------------------------------------------------------ 
ERROR: Error during Sonar runner execution 
org.sonar.runner.impl.RunnerException: Unable to execute Sonar 
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91) 
    at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) 
    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) 
    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) 
    at org.sonar.runner.api.Runner.execute(Runner.java:100) 
    at org.sonar.runner.Main.executeTask(Main.java:70) 
    at org.sonar.runner.Main.execute(Main.java:59) 
    at org.sonar.runner.Main.main(Main.java:53) 
Caused by: Unable to determine database dialect to use within sonar with dialect null jdbc url localhost 
Build step 'Invoke Standalone SonarQube Analysis' marked build as failure 
Finished: FAILURE 

裏面我Jenkins->管理Jenkins->配置系統,我已經配置了聲納QUBE部分如截圖所示如下─ SonarQube SetUp

這是我構建的截圖config-

enter image description here

我沒有得到關於如何調試的線索?任何建議?

以下是版本詳情 -

SonarQube亞軍2.4

聲納5.1版

+0

什麼SonarQube平臺的版本? –

+0

SonarQube Runner 2.4 聲納版本5.1 – piyush

回答

2

你能仔細檢查,如果你指定了正確的JDBC URL。在附帶的屏幕截圖中,SonarQube的數據源URL被配置爲'localhost'。

stacktrace再次表示您沒有指定數據庫方言。這可以在聲納屬性文件中指定。

0

我意識到,這裏出了什麼問題。我在jenkins配置中添加了不正確的數據庫方言(Jenkins-> Manage Jenkins-> Configure System)。看截圖。早些時候,我已經使用

localhost 

,而不是

jdbc:mysql://localhost:3306/sonar?autoReconnect=true&useUnicode=true&characterEncoding=utf8 

enter image description here

+1

看起來它已經被D J回答了! –