Linux安装Sonar-Scanner扫描器
2021/4/29 7:29:25
本文主要是介绍Linux安装Sonar-Scanner扫描器,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1、下载地址
https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/
2、解压压缩包
unzip sonar-scanner-cli-4.6.0.2311-linux.zip
3、配置环境变量
编辑全局配置文件profile:
vim /etc/profile
#配置sonar-scanner
export SONARRUNNER_HOME=/home/sonar-scanner/sonar-scanner-4.6.0.2311-linux
export PATH=$SONARRUNNER_HOME/bin:$PATH
保存并退出
使配置生效 source /etc/profile
4、编辑配置文件,添加配置信息
编辑vim /home/sonar-scanner/sonar-scanner-4.6.0.2311-linux/conf/sonar-scanner.properties
sonar.host.url=http://10.0.6.XX:9000
sonar.login=1df8fdddf6d50847c852de4bfb89f2d95d80f013
sonar.sourceEncoding=UTF-8
5、测试
sonar-scanner -h
出现以下内容,则安装成功
6、上传项目到SonarQube
在项目根目录下创建sonar-project.properties配置文件
# must be unique in a given SonarQube instance
sonar.projectKey=项目名称
# this is the name displayed in the SonarQube UI
sonar.projectName=项目名称
sonar.projectVersion=1.0
sonar.java.binaries=target/classes
sonar.sources=扫描文件目录
注:target/classes 此文件夹只有编译后,才会生成,默认无此目录,也可以将此目录替换为扫描的路径即可!
7、执行扫描
在sonar-project.properties所在目录 也就是 项目根目录 执行sonar-scanner就可以扫描了
扫描成功后在SonarQube会生成数据,效果图
这篇关于Linux安装Sonar-Scanner扫描器的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-30[译]漫画SELinux概念
- 2024-03-29linux 移动文件
- 2024-03-28linux .so file
- 2024-03-28Linux 磁盘管理
- 2024-03-28Linux学习笔记(十三)磁盘管理(一):磁盘分区
- 2024-03-26linux 创建 文件
- 2024-03-25使用SecureCRT对Linux vim进行颜色设置
- 2024-03-202019-2020-12 20199317 《Linux内核原理与分析》 第十二周作业
- 2024-03-20Linux运维的第二周总结
- 2024-03-13how to count number of directories in linux