汽车网站建设公司哪家好,网站建设开公司现在好做吗,wordpress账户密码忘记,青岛网站建设策划文章目录 一、前提配置1.1 安装及配置SonarQube Scanner插件1.2 配置SonarQube servers 二、非流水线集成SonarQube1.1 配置非流水线任务 三、流水线集成SonarQube 一、前提配置
1.1 安装及配置SonarQube Scanner插件
(1) 点击【系统管理】【插件管理】【可选插件】搜… 文章目录 一、前提配置1.1 安装及配置SonarQube Scanner插件1.2 配置SonarQube servers 二、非流水线集成SonarQube1.1 配置非流水线任务 三、流水线集成SonarQube 一、前提配置
1.1 安装及配置SonarQube Scanner插件
(1) 点击【系统管理】【插件管理】【可选插件】搜索SonarQube Scanne点击安装 (2)点击【系统管理】【全局工具配置】搜索SonarQube Scanner新建一个自动安装
1.2 配置SonarQube servers
(1)使用admin用户登入sonar平台点击【右上角用户头像】【我的账号】【安全】生成一个新的令牌复制令牌内容后面会使用到 (2)新建凭证点击【系统管理】【Manager files】【全局】创建sonar凭证 (3)点击【系统管理】【系统配置】搜索到 SonarQube servers 进行配置 (4)SonarQube关闭审查上传SCM功能
二、非流水线集成SonarQube
1.1 配置非流水线任务 # 项目唯一标记
sonar.projectKeyweb_JAR
# 项目名字
sonar.projectNameweb_JAR
# 版本号
sonar.projectVersion1.0
# 指定扫描目录 点表示项目根目录
sonar.sources.
# 对test、target目录不进行扫描
sonar.exclusions**/test/**,**/target/**
# JDK设置
sonar.java.source1.8
sonar.java.target1.8
# 字符集
sonar.sourceEncodingUTF-8三、流水线集成SonarQube
(1) 项目根目录创建sonar-project.properties文件
# must be unique in a given SonarQube instance
sonar.projectKeyweb_demo
# this is the name and version displayed in the SonarQube UI. Was mandatory
prior to SonarQube 6.1.
sonar.projectNameweb_demo
sonar.projectVersion1.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.exclusions**/test/**,**/target/**
sonar.java.source1.8
sonar.java.target1.8
# Encoding of the source code. Default is default system encoding
sonar.sourceEncodingUTF-8流水线代码
pipeline {agent anystages {stage(拉取代码) {steps {checkout([$class: GitSCM, branches: [[name: */main]], extensions: [], userRemoteConfigs: [[url: git152.136.184.149:gitlab-instance-0d7d20f4/cicd.git]]])}}stage(打JAR包) {steps {sh mvn clean package}}stage(SonarQube代码审查) {steps{script {//引入Jenkins SonarQube-Scanner全局工具 全局配置中以SonarQube-Scanner命名的工具scannerHome tool SonarQube-Scanner}//引用SonarQube环境 系统配置中配置的SonarQube servers的name值 withSonarQubeEnv(sonar) {//执行sonar-scanner命令sh ${scannerHome}/bin/sonar-scanner}}}stage(部署前操作) {steps {sshPublisher(publishers: [sshPublisherDesc(configName: 120.48.34.146, transfers: [sshTransfer(cleanRemote: false, excludes: , execCommand: source /etc/profile
bash /home/qinzt/jar/helloword/run.sh stop helloword-*.jar
mv /home/qinzt/jar/helloword/helloword-*.jar{,.$(date %F-%S)}, execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: [, ], remoteDirectory: , remoteDirectorySDF: false, removePrefix: , sourceFiles: )], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])}}stage(远程部署) {steps {sshPublisher(publishers: [sshPublisherDesc(configName: 120.48.34.146, transfers: [sshTransfer(cleanRemote: false, excludes: , execCommand: source /etc/profile
cd /home/qinzt/jar/helloword ./run.sh start helloword-*.jar, execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: [, ], remoteDirectory: jar/helloword, remoteDirectorySDF: false, removePrefix: target, sourceFiles: **/helloword-*.jar)], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])} }}post {//构建失败发邮件通知unsuccessful {emailext attachLog: true, body: ${FILE,pathemail.html}, subject: 【构建通知】${PROJECT_NAME}, to: 1790168505qq.com}}
}