简体   繁体   English

Jenkins / Sonar集成

[英]Jenkins / Sonar integration

I am trying to use the jenkins sonar plugin, 我正在尝试使用jenkins声纳插件,

whenever i try to do a build i get the following error; 每当我尝试进行构建时,都会出现以下错误;

> ERROR: Error during Sonar runner execution ERROR: Unable to execute
> Sonar ERROR: Caused by: Fail to connect to database ERROR: Caused by:
> Cannot create JDBC driver of class 'org.h2.Driver' for connect URL
> 'http://localhost:9092/sonar' ERROR: Caused by: No suitable driver
> ERROR:  ERROR: To see the full stack trace of the errors, re-run Sonar
> Runner with the -e switch. ERROR: Re-run Sonar Runner using the -X
> switch to enable full debug logging. Build step 'Invoke Standalone
> Sonar Analysis' marked build as failure Finished: FAILURE

My properties file for sonar server has the following entries 我的声纳服务器属性文件包含以下条目

#----- Credentials
# Permissions to create tables and indexes must be granted to JDBC user.
# The schema must be created first.
sonar.jdbc.username=                       sonar
sonar.jdbc.password=                       sonar

#----- Embedded database H2
# Note : it does not accept connections from remote hosts, so the
# sonar server and the maven plugin must be executed on the same host.

# Comment the following line to deactivate the default embedded database.
sonar.jdbc.url=                           jdbc:h2:tcp://localhost:9092/sonar;create=true
sonar.jdbc.driverClassName:               org.h2.Driver

# directory containing H2 database files. By default it's the /data directory in the sonar installation.
sonar.embeddedDatabase.dataDir=D:/Sonar/sonar-3.2/data
# H2 embedded database server listening port, defaults to 9092
sonar.embeddedDatabase.port:               9092

My config file in jenkins for sonar contains the following; 我在jenkins中用于声纳的配置文件包含以下内容;

>  # Additional parameters sonar.jdbc.dialect=h2
> sonar.jdbc.driverClassName: org.h2.Driver
> sonar.jdbc.driver=D:\Sonar\sonar-3.2\extensions\jdbc-driver\h2\h2-1.3.167.jar

What setting am i missing here for the driver to be found? 我在这里缺少什么设置来查找驱动程序?

Thanks 谢谢

Check your Maven logs and your pom.xml : I suspect your are using an old version of the maven Sonar plugin. 检查您的Maven日志和pom.xml:我怀疑您使用的是旧版本的maven Sonar插件。

Maybe your are forcing its version to 2.0. 也许您将其版本强制为2.0。

The plugin should be either 插件应该是

org.codehaus.sonar:sonar-maven-plugin:3.5 org.codehaus.sonar:sonar-maven-plugin:3.5

or 要么

org.codehaus.sonar:sonar-maven3-plugin:3.5 org.codehaus.sonar:sonar-maven3-plugin:3.5

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

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