放肆青春的博客
首页
前端
算法
网络
面试
技术
后端
运维
杂项
数据库
工具
网址
电脑
个人
文章
  • 分类
  • 标签
  • 归档
github (opens new window)
gitee (opens new window)

放肆青春

一个前端菜鸟的技术成长之路
首页
前端
算法
网络
面试
技术
后端
运维
杂项
数据库
工具
网址
电脑
个人
文章
  • 分类
  • 标签
  • 归档
github (opens new window)
gitee (opens new window)
  • 开发相关

    • 项目管理

      • 团队工具
      • git

      • UI 及 UE工具
      • 代码管理
      • jenkins
      • sonar
        • sonar
          • windows 上搭建 sonar 平台
      • 移动端调试
      • nexus
    • 开发工具

      • node
      • npm
      • yarn
      • pm2
      • pnpm
      • safe
      • eslint
      • gitbook
      • vuepress 总结
      • vitepress
      • markdown
    • 开发软件

      • software
      • vscode
      • postman
      • SourceTree
      • idea
      • sublime
      • notepad
      • ediplus
      • xmind
    • 浏览器

      • chrome 汇总
      • chrome lighthouse
      • firefox
  • office

    • excel

      • excel
    • word

      • word
    • ppt

      • ppt
  • 实用工具

    • ps
    • premiere
  • tools
放肆青春
2020-07-09

sonar

# sonar

sonar:开源的代码质量管理平台

  • 官网 http://www.sonar.org.cn/ (opens new window)

# windows 上搭建 sonar 平台

# 使用步骤

    1. 点击(bin\windows-x86-64\StartSonar.bat) StartSonar.bat 启动
    1. 在 cmd 进入项目所在的根目录,输入命令:sonar-scanner
    1. 浏览器打开 http://localhost:9000/

# SonarQube 安装

注意事项:SonarQube 7.9 以上版本已不再支持 mysql,MySQL >=5.6 && <8.0

  • 下载地址

官网下载地址:https://www.sonarqube.org/downloads/ (opens new window)

sonarqube-7.6 下载地址: https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-7.6.zip (opens new window)

sonar-scanner 下载地址:https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.3.0.1492-windows.zip (opens new window)

  • 使用教程 https://www.cnblogs.com/qlqwjy/p/10551283.html (opens new window)

      1. 启动(bin\windows-x86-64\StartSonar.bat 解压后点击 StartSonar.bat 启动)
      1. 打开 conf\sonar.properties
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
sonar.jdbc.username=root
sonar.jdbc.password=admin
sonar.sorceEncoding=UTF-8
#sonar.jdbc.driverClassName=com.mysql.jdbc.Driver
sonar.login=admin
sonar.password=admin
#sonar.web.port=9090
#sonar.host.url=http://localhost:9090
1
2
3
4
5
6
7
8
9
    1. 注意:如果测试项目与服务器不在同一台机子,则需要添加服务器的 IP:
    #----- Default SonarQube server
    sonar.host.url=http://XXX.XXX.XXX.XXX:9000
    
    1
    2

# sonar-scanner 使用

sonar-scanner 下载地址:https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.3.0.1492-windows.zip (opens new window)

    1. 配置 sonar-scanner-3.3.0.1492-windows\conf\sonar-scanner.properties
sonar.jdbc.username=root
sonar.jdbc.password=admin
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
1
2
3
    1. 打开要进行代码分析的项目根目录,新建 sonar-project.properties 文件

其中:projectName 是项目名字,sources 是源文件所在的目录

# must be unique in a given SonarQube instance
sonar.projectKey=my:project
# this is the name displayed in the SonarQube UI
sonar.projectName=项目名
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.
sonar.sources=src

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
    1. 设置成功后,启动 sonarqube 服务,并启动 cmd
    1. 在 cmd 进入项目所在的根目录,输入命令:sonar-scanner

# 汉化

https://github.com/SonarQubeCommunity/sonar-l10n-zh/releases (opens new window)

下载 jar 包

复制 jar 包到 extensions\plugins 文件夹下

# 问题

    1. sonarqube 启动时报错 WrapperSimpleApp: Encountered an error running main: java.nio.file.AccessDeniedException

杀死所有 java 进程 taskkill /f /t /im java.exe
删除 sonarqube temp 目录下的所有文件即可

更新时间: 6/11/2021, 10:00:02 AM
jenkins
移动端调试

← jenkins 移动端调试→

最近更新
01
前端权限管理
02-24
02
vue2指令
02-24
03
vue2 hook
02-24
更多文章>
Theme by Vdoing | Copyright © 2019-2022 放肆青春
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式