集成SonarQube

1、下载安装SonarQube 5.3,直接解压,修改conf中的properties文件中的数据库的配置,运行bin中的 StartSonar.bat即可;访问 http://localhost:9000/能看到效果;

2、安装maven的Sonar-scanner插件,具体操作如下:就可以将maven的运行结果,和jacoco的分析结果上传进行分析:(关于Sonar-runner的文章,已经过时了)

(运行正常!整合的jacoco的测试覆盖率,还有一个新的插件,第一次发现本地没有回去中央仓库下载,第二次,就用上一次下载下来的了。)

Initial Setup

Global Settings

Edit the settings.xml file, located in $MAVEN_HOME/conf or ~/.m2, to set the plugin prefix and optionally the SonarQube server URL.

Example:

< settings >
     < pluginGroups >
         < pluginGroup >org.sonarsource.scanner.maven</ pluginGroup >
     </ pluginGroups >
     < profiles >
         < profile >
             < id >sonar</ id >
             < activation >
                 < activeByDefault >true</ activeByDefault >
             </ activation >
             < properties >
                 <!-- Optional URL to server. Default value is http://localhost:9000 -->
                 < sonar.host.url >
                   http://myserver:9000
                 </ sonar.host.url >
             </ properties >
         </ profile >
      </ profiles >
</ settings >

Analyzing a Maven Project

Analyzing a Maven project consists of running a Maven goal: sonar:sonar in the directory where the pom.xml file sits.

mvn clean verify sonar:sonar
 
# In some situation you may want to run sonar:sonar goal as a dedicated step. Be sure to use install as first step for multi-module projects
mvn clean install
mvn sonar:sonar
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值