Maven与Sonar配合使用

1、Sonar安装部署

下载地址:http://www.sonarqube.org/downloads/ 
http://dist.sonar.codehaus.org/sonarqube-4.5.4.zip 
下载: 
# wget http://dist.sonar.codehaus.org/sonarqube-4.5.4.zip 
解压安装: 
# unzip sonarqube-4.5.4.zip 
# mv sonarqube-4.5.4 sonarqube  
编辑 sonar 配置: 
# cd sonarqube/conf/ 
# vi sonar.properties 
sonar.jdbc.username=root 
sonar.jdbc.password=123456
#----- MySQL 5.x 
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance  
sonar.web.host=0.0.0.0 
sonar.web.context=/sonarqube 
sonar.web.port=9090

浏览器中输入:http://192.168.10.50:9090/sonarqube/ 

下载soanr的中文插件
地址:http://docs.codehaus.org/display/SONAR/Plugin+Library

在这里有丰富的插件

 https://github.com/SonarQubeCommunity

http://mvnrepository.com/open-source/sonar-plugins
插件也可以从系统本身的插件库进行安装,在系统配置里可以进行安装
将down下来的中文包放到*/sonarqube-4.5.7\extensions\plugins,然后重新启动即可

2.在本地maven中配置sonar:打开setting.xml配置文件,在其中加入如下代码:

<profile>
   <id>sonar</id>
   <activation>
      <activeByDefault>true</activeByDefault>
   </activation>
   <properties>
      <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterEncoding=utf8</sonar.jdbc.url>
      <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>
      <sonar.jdbc.username>root</sonar.jdbc.username>
      <sonar.jdbc.password>123456</sonar.jdbc.password>
      <!-- SERVER ON A REMOTE HOST -->
      <sonar.host.url>http://192.168.10.50:9090</sonar.host.url>
   </properties>
</profile>
3.运行项目pom文件,输入 clean install sonar:sonar
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值