title: How to setup sonar scanner in Jenkins Declarative Pipeline
body: <p>I'm facing a problem in implementing SonarQube scanner for my repository in Jenkinsfile. I don't know where should I add the properties of SonarQube scanner in the Jenkinsfile.</p>
  
  <p>I've set Jenkins locally on my windows system. The projects are purely based on Python, Ruby &amp; React.</p>
  
  <pre><code>  agent {label 'master'}
    triggers {
      GenricTrigger ([
      genricVariables: [
      key: 'pr_from_branch', value: '$.pullrequest.source.branch.name'],
      [
      expressionType: 'JsonPath',
      regexpFilter: '',
      defaultValue: ''],
      token: 'test'])
    }
    options {
      buildDiscarder (
        logRotator(numToKeepStr:'5'))
      }
     stages {
        stage ('Initialize &amp; SonarQube Scan') {
          steps {
          def scannerHome = tool 'sonarScanner';
          withSonarQubeEnv('My SonarQube Server') {
  
            bat """
               ${scannerHome}/bin/sonar-runner.bat
               pip install -r requirements.txt
               """
               }
            }
        }
        stage('Quality Gate') {
        sleep time: 3000, unit: 'MILLISECONDS'
          timeout(time: 1, unit: 'MINUTES') { // Just in case something goes wrong, pipeline will be killed after a timeout
          def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv
          if (qg.status != 'OK') {
          error "Pipeline aborted due to quality gate failure: ${qg.status}"
          }
         }
        }
        stage ('Smoke Test') {
          steps {
            bat """
               pytest -s -v tests/home/login_test.py
               currentBuild.result = 'SUCCESS'
               """
          }
        }
      }
  }
  </code></pre>
  
  <p>The properties include:</p>
  
  <pre><code> -----------------Sonarqube configuration........................
  
  sonar.projectKey=&lt;*****&gt;
  sonar.projectName=&lt;project name&gt;
  sonar.projectVersion=1.0
  sonar.login=&lt;sonar-login-token&gt;
  sonar.sources=src
  sonar.exclusions=**/*.doc,**/*.docx,**/*.ipch,/node_modules/,
  sonar.host.url=http://&lt;url&gt;/
  
  -----------------Sonar for bitbucket plugin configuration...................
  
  sonar.bitbucket.repoSlug=&lt;project name&gt;
  sonar.bitbucket.accountName=&lt;name&gt;
  sonar.bitbucket.oauthClientKey=&lt;OAuth_Key&gt;
  sonar.bitbucket.oauthClientSecret=&lt;OAuth_secret&gt;
  sonar.analysis.mode=issues
  </code></pre>
  
  <p>I can manually add these properties in sonar-project.properties file and set this file in my project root directly but it will be running locally not on the server. So to avoid that I want to add these properties to Jenkinsfile </p>