踩坑:Jenkin 与 SonarQube 的JDK版本必须一致,此项目JDK版本为11
安装SonarQube Scanner插件
添加SonarQube凭证
4b3138b07a529d83bd427a8357ec723d656fb971
Jenkins进行SonarQube配置
系统管理->系统配置->SonarQube servers
系统管理->全局工具配置
SonaQube关闭审查结果上传到SCM功能
在项目添加SonaQube代码审查(流水线项目)
1)项目根目录下,创建sonar-project.properties文件
# must be unique in a given SonarQube instance
sonar.projectKey=SpringBootDemo
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 9.3.0
sonar.projectName=SpringBootDemo
sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=.
sonar.java.binaries=./target/classes
sonar.exclusions=**/test/**,**/target/**
sonar.java.source=11
sonar.java.target=11
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8