Integrate SonarQube with Jenkins pipeline

System Environment

  • Installed the SonarQube 7.4 in my winodows and installed the sonar qube scanner plugin with version 2.8.1


  • We want to get the static code analysis report(coverage, duplication of codes and code quality) of my project in sonr qube server

Tried so far:

I have added my sonar qube server details in Jenkins configuration.

I have addded the below files in my project


sonar.sources= src


I have added the below stage in jenkins file because I am using pipeline jobs.

stage(‘SonarQube analysis’)
// requires SonarQube Scanner 2.8+
def scannerHome = tool ‘SonarQube Scanner 2.8’;
withSonarQubeEnv(‘My SonarQube Server’) {
bat “${scannerHome}/bin/sonar-scanner”

I have tried above mutiple projects and faced the below kind of error.

Issue 1

got the empty report

Issue 2:

faced the error which have mentioned in below consolidated issues image

Issue 3:

In some of the project I faced the error sonarproject.key and sonar.sorces was not defined even I defined the sonar.project.key and sonar.sorces in sonar properties file.

Could you please help to achieve my requirement?

The correct file name is :slight_smile:

sorry wrongly mentioned in my query.I have already set the properties file name as even though I am facing same issues.