[英]Configuring Sonar plugin for Jenkins
我在Jenkins
上配置Sonar
插件時有些困惑。 我去了Manage Jenkins- > Configure System並添加了Sonar
。我對Sonar
部分中的Database
URL中的內容感到困惑。
我放
jdbc:mysql://10.4.1.206/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
10.4.1.206是我要連接的節點。
但是,端口是3306。
我應該放
jdbc:mysql://10.4.1.206:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true or just leave it like before?
另外,由於我使用的是MySQL
,是否需要將com.mysql.jdbc.Driver放在“ Driver
部分中? 如果我使用嵌入式默認驅動程序,則說將其留空。
請原諒我; 這是我第一次篡改Jenkins
和Sonar
。
如果您已將Sonar配置為使用MySQL,則需要同時提供URL和驅動程序。 Sonar的默認嵌入式數據庫是Derby-在下面,您將找到默認聲納配置的示例:
# Comment the 3 following lines to deactivate the default embedded database
sonar.jdbc.url: jdbc:derby://localhost:1527/sonar;create=true
sonar.jdbc.driverClassName: org.apache.derby.jdbc.ClientDriver
sonar.jdbc.validationQuery: values(1)
因此,如果您已經將Sonar配置為使用MySQL,而我只能假設您已經擁有,那么讓我們分析一下配置本身:
您需要明確聲明的驅動程序是com.mysql.jdbc.Driver
。
您的網址字符串對我來說看起來不錯。 根據MySQL Connect規范:
MySQL Connector / J的JDBC URL格式如下,方括號([,])中的項目是可選的:
jdbc:mysql://[host][,failoverhost...][:port]/[database] » [?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...
如果未指定主機名,則默認為127.0.0.1。 如果未指定端口,則默認為MySQL服務器的默認端口號3306。
jdbc:mysql://[host:port],[host:port].../[database] » [?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...
在我當前的設置中,連接如下:
jdbc:mysql://localhost:3306/radical_sonar?useUnicode=true&characterEncoding=utf8
我傾向於顯式地使用端口號,以避免混亂,而不是其他任何事情-我們確實在不同的端口上運行了測試MariaDB安裝...
在Manage Jenkins>配置系統中 ,您的聲納設置應如下所示:
數據庫URL應該是:
jdbc:mysql://10.4.1.206:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
驅動程序應為:
com.mysql.jdbc.Driver
如果您需要更多信息,則可能還需要查看“ sonarqube / conf / sonar.properties”文件和以下文檔鏈接
http://docs.codehaus.org/display/SONAR/Configuring+SonarQube+Jenkins+Plugin
祝您配置順利!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.