maven+sonarqube测试代码质量

来源:互联网 发布:百度云传智播客java 编辑:程序博客网 时间:2024/05/16 19:27
前提:安装好sonarqube 参考教程《linux下安装sonarqube5.6.6》


测试过程

①.修改本地maven的settings.xml <profiles></profiles>节点中添加如下配置:
[html] view plain copy
  1. <profile>  
  2.     <id>sonar</id>  
  3.     <activation>  
  4.         <activeByDefault>true</activeByDefault>  
  5.     </activation>  
  6.     <properties>  
  7.         <!-- Example for MySQL-->  
  8.         <sonar.jdbc.url>  
  9.             jdbc:mysql://192.168.17.168:3306/sonarqube?useUnicode=true&characterEncoding=utf8  
  10.         </sonar.jdbc.url>  
  11.         <sonar.jdbc.username>root</sonar.jdbc.username>  
  12.         <sonar.jdbc.password>123456</sonar.jdbc.password>  
  13.         <!-- Optional URL to server. Default value is http://localhost:9000 -->  
  14.         <sonar.host.url>http://192.168.17.168:9090/sonarqube</sonar.host.url>  
  15.     </properties>  
  16. </profile>  


②.随便找一个类,故意搞两个bug

  
③右击项目,按照如图操作

  
④成功执行完分析命令后便可到 Web Server 中查看代码质量分析结果数据


阅读全文
0 0
原创粉丝点击