为Jenkins配置声纳插件
在为Jenkins配置声纳插件,jenkins,sonarqube,Jenkins,Sonarqube,在Jenkins上配置Sonar插件时,我有些困惑。我去了管理Jenkins->配置系统并添加了声纳。我不知道在声纳部分的数据库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/so
Jenkins
上配置Sonar
插件时,我有些困惑。我去了管理Jenkins->配置系统并添加了声纳
。我不知道在声纳
部分的数据库
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-下面是默认Sonar配置的示例:
# 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,我只能假设您已经使用了MySQL,那么让我们分析一下配置本身:
需要显式声明的驱动程序是com.mysql.jdbc.driver
你的URL字符串看起来不错。根据MySQL Connect规范:
MySQL Connector/J的JDBC URL格式如下,方括号([,])中的项目是可选的:
jdbc:mysql://[host][,failoverhost...][:port]/[database] »
[?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...
如果未指定主机名,则默认为127.0.0.1。如果未指定端口,则默认为3306,这是MySQL服务器的默认端口号
jdbc:mysql://[host:port],[host:port].../[database] »
[?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...
在我当前的设置中,连接如下所示:
jdbc:mysql://localhost:3306/radical_sonar?useUnicode=true&characterEncoding=utf8
我倾向于明确使用端口号,以避免混淆,而不是其他任何事情-我们有一个测试MariaDB安装在不同的端口上运行…在管理Jenkins>配置系统中,您的声纳设置应如下所示:
jdbc:mysql://localhost:3306/radical_sonar?useUnicode=true&characterEncoding=utf8
数据库URL应为:
jdbc:mysql://10.4.1.206:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
com.mysql.jdbc.Driver
司机应:
jdbc:mysql://10.4.1.206:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
com.mysql.jdbc.Driver
如果您需要更多信息,您可能还需要查看“sonarqube/conf/sonar.properties”文件和以下文档链接
祝你的配置好运