Friday, February 20, 2026

How to Integrate SonarQube Cloud with Jenkins | Jenkins SonarQube Cloud Integration | Automate Static Code Quality Analysis with SonarQube Cloud from Jenkins

Automate Static Code Quality Analysis with SonarCloud from Jenkins



Pre-requisites in SonarCloud:




Depending on your SCM tool, We will use GitHub. So please click on it.
Enter GitHub credentials to setup your account in SonarCloud. Click Authorize SonarQube Cloud.


Go to SonarCloud → My Account → Organizations → Create/Select organization

Choose “Import from GitHub” (or connect GitHub) and Install the SonarCloud GitHub App

Start analyzing a project:

Select Project and Click on Setup:


Check any one of the options to confirm what is new code:

Select with other CI tools

Select Maven, note organization key, project key and token.


Pre-requisites in Jenkins:
  • SonarQube plug-in - Make sure this plug-in is installed.
  • pipeline stage view plug-in

    After setting up SonarCloud successfully, login to Jenkins. Manage Jenkins --> Configure System --> SonarQube installation 

    Server URL should be https://sonarcloud.io/
    Enter Sonar token as secret text and select it from the drop down

     
    Jenkins Pipeline code for running scan in SonarCloud

    node {

        def mvnHome = tool 'Maven3'
        stage ("checkout")  {
            git branch: 'main', credentialsId: '', url: 'https://github.com/akannan1087/my-javawebapp-repo'
        }

       stage ('build')  {
        sh "${mvnHome}/bin/mvn clean install -f MyWebApp/pom.xml"
        }

         stage ('Code Quality scan')  {
           withSonarQubeEnv('SonarCloud') {
                sh """
                  ${mvnHome}/bin/mvn -f MyWebApp/pom.xml \
                 org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar \
                  -Dsonar.organization=org_key \
                  -Dsonar.projectKey=com.dept.app:MyWebApp \
                  -Dsonar.projectName=MyWebApp
                """
            }
       }
    }

    Now login to SonarCloud under --> https://sonarcloud.io/projects


    Here is the pipeline view:

    Watch steps in YouTube Video:

    2 comments:

    1. Starting a business requires proper legal recognition and structured compliance. When you plan to Register A Company In India, it is important to choose the right business structure, secure name approval, and complete all required government filings. Accurate documentation ensures smooth incorporation and long-term credibility. With professional assistance from Taxlegit, entrepreneurs can complete the registration process efficiently and focus on building and managing their business operations confidently.

      ReplyDelete

    2. Darpan registration is mandatory for NGOs seeking government grants and recognition. NGOExperts assists with complete documentation, online application filing, and follow-ups on the NGO Darpan portal. Our experts ensure error-free submission so your organization receives its unique ID smoothly and becomes eligible for government schemes.

      ReplyDelete

    Coach AK's Master DevSecOps Bootcamp Program Model Information | Master Multi cloud Program Information | AWS Cloud and Azure Cloud DevOps Coaching Program Model Information

    (More New Topics..New tools added such as GitHub Actions, Helm, GitHub Advanced Security and Trivy Scanner, CheckOv IAC security ...