1.下载SonarQube 5.2 http://www.sonarqube.org/downloads/
2.解压后配置sonarqube-5.2\conf下的sonar.properties
选择相应的数据库 本例为mysql
前提是要先建立数据库sonar 账号:root 密码:admin
#----- MySQL 5.x
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported. It can not be changed.
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
sonar.jdbc.username=root
sonar.jdbc.password=admin
sonar.sorceEncoding=UTF-8
sonar.login=admin
sonar.password=admin
3.在bin中选择当前自己的系统找到StartSonar.bat运行,打开http://localhost:9000 登录账号密码就是之前设置的admin admin这时默认里面是没有项目的
可以安装一些插件比如中文插件 Chinese Pack 安装完成需要重启服务
4.添加项目 在maven的setting.xml中增加
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar</sonar.jdbc.url>
<sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>
<sonar.jdbc.username>root</sonar.jdbc.username>
<sonar.jdbc.password>admin</sonar.jdbc.password>
<!-- SERVER ON A REMOTE HOST -->
<sonar.host.url>http://localhost:9000</sonar.host.url>
</properties>
</profile>
5.Eclipse中先maven clean然后再sonar:sonar这时就添加成功了
6.打开http://localhost:9000 该分析分析。。。
By the way,elipse 的插件SonarQube3.5有问题。。。搞了好久报空指针,建议还是表用了。Sonar-runner是不是操作太烦了。。。
内容来自网络、、、、
本文提供了一步一步的指导,帮助读者完成SonarQube5.2的下载、安装及配置过程,并详细介绍了如何通过Maven和Eclipse进行项目分析。
1415

被折叠的 条评论
为什么被折叠?



