前提:安装好sonarqube 参考教程《linux下安装sonarqube5.6.6》
测试过程
①.修改本地maven的settings.xml <profiles></profiles>节点中添加如下配置:
-
<profile>
-
<id>sonar</id>
-
<activation>
-
<activeByDefault>true</activeByDefault>
-
</activation>
-
<properties>
-
<!-- Example for MySQL-->
-
<sonar.jdbc.url>
-
jdbc:mysql://192.168.17.168:3306/sonarqube?useUnicode=true&characterEncoding=utf8
-
</sonar.jdbc.url>
-
<sonar.jdbc.username>root</sonar.jdbc.username>
-
<sonar.jdbc.password>123456</sonar.jdbc.password>
-
<!-- Optional URL to server. Default value is http://localhost:9000 -->
-
<sonar.host.url>http://192.168.17.168:9090/sonarqube</sonar.host.url>
-
</properties>
-
</profile>
②.随便找一个类,故意搞两个bug

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


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

相关文章: