SonarQube的安装
来源:互联网 发布:golang redis expire 编辑:程序博客网 时间:2024/06/05 00:31
1、jdk1.8 mysql5.6(以上)2、下载sonarqube http://www.sonarqube.org/downloads/ 2.1、解压,修改配置文件sonarqube-*\conf\sonar.properties sonar.login=admin sonar.password=admin #不配置就用默认的h2
#myslq配置 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-82.2、启动 a、进入sonarqube-*/bin/ b、./sonar.sh start 2.3、登陆 http://localhost:9000 administrator --> System --> Update center --> avaliable --> Chinese Pack汉化包 3、下载sonar runner安装包 http://repo1.maven.org/maven2/org/codehaus/sonar/runner/sonar-runner-dist/2.3/sonar-runner-dist-2.3.zip 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://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance sonar.jdbc.username=root sonar.jdbc.password=123456分析,环境变量(略)
一、maven 环境
Maven仓库中就有SonarQube Scanner工具的插件,只要在D:\other\apache-maven-3.0.5\conf\setting.xml文件中添加如下配置
<settings>
<pluginGroups>
<pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
</pluginGroups>
<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://myserver:9000
</sonar.host.url>
</properties>
</profile>
</profiles>
</settings>
配置完成后,在项目中,执行mvn sonar:sonar,SonarQube Scanner会自动扫描,根据pom.xml文件得出项目相关信息,不需要自定义sonar-project.properties。扫描完成后就会上传只Sonarqube服务器中。稍后,登陆服务器中就可以看到分析结果了。
二、手动扫描 sonar-runner -version4.1打开要进行代码分析的项目根目录,新建sonar-project.properties文件 sonar.projectKey=my:task # this is the name displayed in the SonarQube UI sonar.projectName=My task sonar.projectVersion=1.0 sonar.projectDescription= task 定时任务调度 # 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=master/src,slave/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-84.2、启动sonarqube服务,在cmd进入项目所在的根目录,输入命令:sonar-runner 5、看结果 打开http://localhost:9000/
备注:扫描时删除.svn 和 .git ,参考
- SonarQube的安装
- SonarQube的安装
- sonarqube的安装
- Windows下SonarQube的安装
- 安装SonarQube
- SonarQube 安装
- Jenkins、SonarQube的安装和简单使用
- Sonarqube 在mac下的安装
- SonarQube的安装、配置与使用
- SonarQube的安装、配置与使用
- SonarQube的安装、配置与使用
- SonarQube的安装、配置与使用
- SonarQube的安装、配置与使用
- SonarQube的安装、配置与使用
- SonarQube代码质量管理平台的安装
- SonarQube的安装、配置与使用
- SonarQube 代码质量管理平台的安装
- SonarQube之——SonarQube 代码质量管理平台的安装与配置
- 使用WebView加载本地网页
- MQTT_笔记
- 来说说(Facade)外观模式
- 关于怎么在mysql中执行*.sql文件
- 整理ING
- SonarQube的安装
- fabric下载文件
- Redis:ServiceStack.Redis之IRedisClient
- Cocoa pods的安装和使用详解
- 毕业季的你准备好面试了吗(上)
- ioctl返回失败,驱动中ioctl没调问题解决
- HBase性能优化指南
- D3弦图制作
- WebStorm 改变字体大小 Ctrl+鼠标滚轮>>>>>设置