Skip to content

How to run SonarQube analysis on local

Jordan Walker edited this page Jun 23, 2020 · 1 revision

I was able to run sonarqube analysis on my local and I will list the steps here so anyone watching this issue can replicate:

  1. Add these at project level build.gradle -
plugins {
   id "jacoco"
   id "org.sonarqube" version "2.7.1" 
} 
jacocoTestReport {
   reports {
       xml.enabled true

   }
}
  1. Run sonarqube instance on docker by running docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube
  2. Open localhost:9000 and login by admin/admin
  3. After logging in click ok "Create New Project" and Enter Project Key = "Check-ins" and click next
  4. Input a token name and click "Generate a token name"
  5. Then run ./gradlew sonarqube -x test -Dsonar.projectKey=Checkins-project -Dsonar.host.url=http://localhost:9000 -Dsonar.login=YOUR TOKEN THAT WAS GENERATED IN STEP 5 Once you run STEP 5, then page will reload and show you the code analysis on localhost:9000. SonarQube

NOTE : I did sonarqube -x test because tests are failing so for now i used this option to generate a report.

Clone this wiki locally