2016-03-14 110 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回答了! –