Articles → SONARQUBE → Integrate Sonarqube With Gradle

Integrate Sonarqube With Gradle


  1. Download gradle from (in the zip format)
  2. Unzip the file and put it inside ‘c:\gradle’.
  3. Set the path of gradle in environment variables
  4. Picture showing adding the path of gradle in the environment variables
    Click to Enlarge

  5. Create a sample android project and open build.gradle.
  6. Inside the file, write the following code on the top.
  7. plugins{
        id "org.sonarqube" version "2.7"

  8. Above dependencies, add the following line
  9. sonarqube{
            property 'sonar.demo_android_project_gradle_integration', 'Project Descp'

  10. Sync the gradle to make sure there are no errors.
  11. Open command prompt
  12. Go to the path where build.gradle is there using cd command.
  13. Write the following command
  14. gradle sonarqube

Picture showing the code scanned using gradle and sonarqube
Click to Enlarge

Picture showing the scanning result in sonarqube admin portal
Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Thursday, October 10, 2019


Your Email Id  
Query/FeedbackCharacters remaining 250