代码质量管理工具 sonar 配置
2024-10-19 06:26:42
代码检查工具有很多findBugs等等
sonar配置:
1、下载sonar 5.5, 解压,运行 sonarqube-5.5\bin\windows-x86-64\StartSonar.bat , 正常可以启动
2、配置 mysql 数据库, 打开conf/sonar.properties
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
创建sonar用户密码以及 sonar数据库,数据库必须InnoDb。
3、配置maven
打开maven的settings.xml文件,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://localhost:9000
</sonar.host.url>
</properties>
</profile>
在maven项目下运行
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 # Specify the version of sonar-maven-plugin instead of using the latest. See also 'How to Fix Version of Maven Plugin' below.
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar
4、打开 http://localhost:9000/
另外现在人都用git、Jenkins自动化部署了,中间加入Gerrit自动化代码审查就构成了完整的CI系统
参考:
1、使用 Sonar 进行代码质量管理 https://www.ibm.com/developerworks/cn/java/j-lo-sonar/
2、http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Maven
3、CI 系统搭建:五. GitLab、Gerrit、Jenkins 三者整合 http://blog.csdn.net/tantexian/article/details/42239025
最新文章
- 两个本地(localhost)html文件之间的传值
- win7共享文件夹给局域网
- linux下安装pymssql
- BZOJ3742 : Painting
- Mac 加密软件
- 夺命雷公狗-----tp中遇到数据乘积的问题的遇见
- 理解C# Attribute
- 不支持的关键字:“provider connection string”报错信息及解决方案
- ASP.NET Core中使用Razor视图引擎渲染视图为字符串
- AutoCompleteTextView ArrayAdapter
- 2010多校第一题 hdu3440House Man 差分约束系统
- Codeforces 443 B. Kolya and Tandem Repeat
- [转]python单元测试unittest
- nginx简单安装设置
- J2EE相关概念,EJB/JNDI/JMS/RMI等
- GWAS群体分层校正,该选用多少个PCA
- DataSource - 常用数据库连接池 (DBCP、c3p0、Druid) 配置说明
- 20155226《网络攻防》 Exp3 免杀原理与实践
- request Dispatch
- javap -- Java 类文件解析器