使用sonarqube对gradle项目分析(for windows)

一、环境准备

  • Gradle versions 3+(Gradle环境搭建教程
  • At least the minimal version of Java supported by your SonarQube server is in use(SonarQube服务器)

  SonarQube搭建教程传送门

  or

 二、下载待扫描的Gradle工程(官网示例)

  下载地址

  https://github.com/SonarSource/sonar-scanning-examples/tree/master/sonarqube-scanner-gradle

三、在下载好的工程示例里配置SonarQube的服务器地址

  1、选择gradle-basic,打开gradle.properties配置文件

# gradle.properties
systemProp.sonar.host.url=http://localhost:9000

实际的

 

   2、检查工程下的build.gradle是否配置有扫描器

plugins {
  id "org.sonarqube" version "3.3"
}

四、执行分析 

 gradle sonarqube -Dsonar.login=yourAuthenticationToken

 

 五、控制台上查看结果

 

posted @ 2021-11-19 10:14  未来可期_Durant  阅读(439)  评论(0编辑  收藏  举报