SonarQube 与 Jenkins 的集成
SonarQube integration with Jenkins
我正在尝试将 SonarQube runner 集成到我的构建过程中。我的构建步骤包括一个 ant build 和 sonar-runner 任务。我稍后附上了截图。我收到一条错误消息“
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
"-
[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.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher.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->Manage Jenkins->Configure System 中,我已经配置了声纳 qube 部分,如下面的屏幕截图所示 -
这是我的构建配置的屏幕截图-
我不知道如何调试?有什么建议吗?
这里是版本详情-
SonarQube 亚军 2.4
声纳版本 5.1
你能仔细检查一下你指定的 JDBC URL 是否正确吗?在随附的屏幕截图中,SonarQube 配置了数据源 URL 作为 'localhost'。
堆栈跟踪再次表明您没有指定数据库方言。这可以在声纳属性文件中指定。
我意识到,这里出了什么问题。我在我的 jenkins 配置中添加了不正确的数据库方言(Jenkins->Manage Jenkins->Configure System)。请参阅屏幕截图。之前我用过
localhost
而不是
jdbc:mysql://localhost:3306/sonar?autoReconnect=true&useUnicode=true&characterEncoding=utf8
我正在尝试将 SonarQube runner 集成到我的构建过程中。我的构建步骤包括一个 ant build 和 sonar-runner 任务。我稍后附上了截图。我收到一条错误消息“
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
"-
[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.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher.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->Manage Jenkins->Configure System 中,我已经配置了声纳 qube 部分,如下面的屏幕截图所示 -
这是我的构建配置的屏幕截图-
我不知道如何调试?有什么建议吗?
这里是版本详情-
SonarQube 亚军 2.4
声纳版本 5.1
你能仔细检查一下你指定的 JDBC URL 是否正确吗?在随附的屏幕截图中,SonarQube 配置了数据源 URL 作为 'localhost'。
堆栈跟踪再次表明您没有指定数据库方言。这可以在声纳属性文件中指定。
我意识到,这里出了什么问题。我在我的 jenkins 配置中添加了不正确的数据库方言(Jenkins->Manage Jenkins->Configure System)。请参阅屏幕截图。之前我用过
localhost
而不是
jdbc:mysql://localhost:3306/sonar?autoReconnect=true&useUnicode=true&characterEncoding=utf8