SonarQube (formerly Sonar) is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs.
We will use the sonarqube docker image to run the sonarqube locally. Afterwards we will run the analysis on local maven java project.
Pull the sonarqube from docker hub
docker pull sonarqube:lts-community
Run sonarqube image locally
You can run the sonarqube with following command. It will run at port 9000
docker run -d –name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:lts-community
You can check at http://localhost:9000
Username: admin / Password: admin
Create Project in Sonarqube
Sonarqube Login
Use admin as username and admin as password.
Update Password
After login it will ask to update the password. Update the password.
Create Project
Manual project creation
Create Test project
Create Test token
Run in maven java project
You can run the maven command to run the analysis for project. Once the analysis is completed it will reflect in the sonarqube.