首页 > 其他 > 详细

SonarQube的安装

时间:2017-03-02 23:24:24      阅读:264      评论:0      收藏:0      [点我收藏+]
1、jdk1.8  mysql5.6(以上)

2、下载sonarqube
    http://www.sonarqube.org/downloads/
    
2.1、解压,修改配置文件sonarqube-*\conf\sonar.properties    
    sonar.login=admin
    sonar.password=admin
    
    sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
    sonar.jdbc.username=root
    sonar.jdbc.password=123456
    sonar.sorceEncoding=UTF-8

2.2、启动
    a、进入sonarqube-*/bin/
    b、./sonar.sh start    

2.3、登陆
    http://localhost:9000
    administrator --> System --> Update center --> avaliable --> 汉化包
    
3、下载sonar runner安装包
    https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/

3.1、解压,修改配置文件sonar-scanner-*\conf\sonar-runner.properties
    sonar.host.url=http://localhost:9000

    sonar.jdbc.url=jdbc:mysql://172.16.30.228:3306/qjfsonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
    sonar.jdbc.username=gmsd
    sonar.jdbc.password=gmsdtrade

4、分析,环境变量(略)
   sonar-runner -version

4.1打开要进行代码分析的项目根目录,新建sonar-project.properties文件
    # must be unique in a given SonarQube instance
    sonar.projectKey=my:apiautocore
    # this is the name displayed in the SonarQube UI
    sonar.projectName=apiautocore(项目名字)
    sonar.projectVersion=1.0
     
    # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
    # Since SonarQube 4.2, this property is optional if sonar.modules is set. 
    # If not set, SonarQube starts looking for source code from the directory containing 
    # the sonar-project.properties file.
    #sources是源文件所在的目录
    sonar.sources=src

    sonar.binaries=WebRoot/WEB-INF/classes
    # Encoding of the source code. Default is default system encoding
    sonar.language=java
    sonar.my.property=value
    #sonar.sourceEncoding=UTF-8

4.2、启动sonarqube服务,在cmd进入项目所在的根目录,输入命令:sonar-runner
    
5、看结果
    打开http://localhost:9000/    

 

SonarQube的安装

原文:http://www.cnblogs.com/sprinng/p/6492695.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!