Sonarqube download and Static Code Analysis Using it

Go to sonarqube.org/download to download Sonarqube Download the community edition

image.png

The download is a zipped folder. Extract the zipped folder

image.png

In the extracted folder go to bin, and them to Windows-x86-64 (assuming Windows OS) to find a file named StartSonar.bat

image.png

Open command prompt and move to the folder where the StartSonar.bat file is stored. Run the command: StartSonar.bat It takes some minutes to run

image.png

Once the command successfully runs, go to localhost:9000 (9000 is the port where sonarqube runs)

image.png

Traverse in the command line to the Maven project whose quality is to be assessed. Run the following command: mvn clean install sonar:sonar -Dsonar.host.url=localhost:9000 -Dsonar.analysis.mode=publish

image.png

The command should run and download the required dependencies and build successfully

image.png

On the location: localhost:9000/projects you will find your maven project being published and the vulnerabilities being assessed

image.png

Additionally, you can further inspect the project published, by clicking directly on the project

image.png