Search code examples
jenkinssonarqubesonarqube-scanjenkins-blueocean

How to execute SonarQube scanner in Jenkins Declarative Pipeline without Maven and Docker


Does SonarQube scanner support BlueOcean pipeline plugin without maven and docker, if it does how does the script works in Jenkinsfile?

I'm new to Jenkins and BlueOcean and have tried all the basic possible aspects available.

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'
        }
      }
    }
  }
}

Solution

  • 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"
                 }
             }

    enter image description here