Installing SonarQube

In this document we would install sonarqube as referred over here

The default user name and password is admin. Now navigate to http://<ipaddress&gt;:9000

Once you login with default credentials

  1. you will be asked to provide a token
  2. Language which you want todo analysis. In this documentation i had selected java & token name as test
Sonar initial

Ensure you copy the token as we will be using in the future

Configuring Jenkins and sonar to perform Code Analysis

Install SonarQube ScannerFor Jenkins Plugin using Plugins Section Refer 

Navigate to Manage Jenkins => Configure System. Scroll down to sonarqube servers and configure the sonarqube installation as shown 

Configuring Jenkins pipeline to perform sonar qube analysis in Jenkins pipeline

Ensure you have Name of server configured in above section.

In the below section i would be configuring the sonarqube analysis on maven based project from jenkins pipeline

node {

   stage('SCM') {
	  git ''
   stage ('build the packages') {
	  sh 'mvn package'
   stage('SonarQube analysis') {
    // performing sonarqube analysis with "withSonarQubeENV(<Name of Server configured in Jenkins>)"
    withSonarQubeEnv('SONAR-6.7.4') {
      // requires SonarQube Scanner for Maven 3.2+
      sh 'mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar'


If you want to perform sonar qube based quality gate check Refer

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner