zoukankan      html  css  js  c++  java
  • 代码质量管理工具 sonar 配置

    代码检查工具有很多findBugs等等

    sonar配置:

    1、下载sonar 5.5, 解压,运行 sonarqube-5.5inwindows-x86-64StartSonar.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 

  • 相关阅读:
    “北漂”的那些年 5
    “北漂”的那些年 4
    全国省市区代码-2020版
    记一次CDH修改IP
    Python爬取抖音视频
    代码生成,减少70%的重复劳动
    Log4J配置详解
    linux常用命令
    tomcat修改默认访问首页
    java根据身份证号和获取用户年龄和性别的工具类
  • 原文地址:https://www.cnblogs.com/xunux/p/5537537.html
Copyright © 2011-2022 走看看