如何在没有 Maven 和 Docker 的 Jenkins 声明式管道中执行 SonarQube 扫描仪 [英] How to execute SonarQube scanner in Jenkins Declarative Pipeline without Maven and Docker
本文介绍了如何在没有 Maven 和 Docker 的 Jenkins 声明式管道中执行 SonarQube 扫描仪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SonarQube 扫描仪是否支持没有 maven 和 docker 的 BlueOcean 管道插件,如果支持,脚本在 Jenkinsfile 中如何工作?
Does SonarQube scanner support BlueOcean pipeline plugin without maven and docker, if it does how does the script works in Jenkinsfile?
我是 Jenkins 和 BlueOcean 的新手,并且已经尝试了所有可用的基本方面.
I'm new to Jenkins and BlueOcean and have tried all the basic possible aspects available.
如果 SonarQube 插件确实支持声明式:
If the SonarQube plugin did support Declarative:
pipeline {
agent any
stages {
stage('SonarQube analysis') {
tools {
sonarQube 'SonarQube Scanner 2.8'
}
steps {
withSonarQubeEnv('SonarQube Scanner') {
sh 'sonar-scanner'
}
}
}
}
}
推荐答案
只需要在通用工具配置中查看工具位置并给出路径并在jenkins文件中调用即可解决.
it is solved one just need to check the tool location in general tool configs and give the path adn call it in jenkins file.
stage('PDNS-UI-Sonar') {
environment {
SONAR_SCANNER_OPTS = "-Xmx2g"
}
steps {
sh "pwd"
sh "/opt/sonar-scanner/bin/sonar-scanner -Dproject.settings=sonar-project.properties"
}
}
这篇关于如何在没有 Maven 和 Docker 的 Jenkins 声明式管道中执行 SonarQube 扫描仪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文