简体   繁体   English

SonarQube与Jenkins的集成

[英]SonarQube integration with Jenkins

I am trying to integrate SonarQube runner in my build process. 我正在尝试将SonarQube运行程序集成到我的构建过程中。 My build steps consists of an ant build and sonar-runner task. 我的构建步骤包括一个蚂蚁构建和声纳运行程序任务。 I have attached the Screenshots later. 我稍后会附上屏幕截图。 I am getting an error stating " 我收到一条错误消息,指出“

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 无法确定要在声纳中与方言一起使用的数据库方言null jdbc url localhost构建步骤“ Invoke Standalone SonarQube Analysis”标记为构建失败

"- “-

[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

Inside my Jenkins->Manage Jenkins->Configure System , I have configured the sonar qube section as shown in the screenshot below- 在我的Jenkins-> Manage Jenkins-> Configure System中,我已经配置了声纳qube部分,如下面的屏幕截图所示- SonarQube设置

Here is the screenshot of my build config- 这是我的构建配置的屏幕截图-

在此处输入图片说明

I am not getting the clue on how to debug ? 我不知道如何调试的线索? Any suggestion ? 有什么建议吗?

Here are the version details- 以下是版本详细信息-

SonarQube Runner 2.4 SonarQube Runner 2.4

Sonar Version 5.1 声纳版本5.1

Can you double check if you are specifying the correct JDBC URL. 您能否再次检查是否指定了正确的JDBC URL。 In the screenshot attached, SonarQube is configured with datasource URL as 'localhost'. 在所附的屏幕快照中,SonarQube配置了数据源URL为“ localhost”。

The stacktrace again says you do not have a database dialect specified. stacktrace再次说您没有指定数据库方言。 This can be specified in the sonar properties file. 可以在声纳属性文件中指定。

I realised, what was wrong here. 我意识到,这里出了什么问题。 I had added incorrect database dialect in my jenkins configuration (Jenkins->Manage Jenkins->Configure System). 我在jenkins配置中添加了不正确的数据库方言(Jenkins->管理Jenkins->配置系统)。 See the screenshot. 查看屏幕截图。 Earlier i had used 我以前用过

localhost

instead of 代替

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

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM