Instructions for installing SonarQube can be found in a separate blog Install SonarQube. Visit the link to setup SonarQube.
SonarQube Web UI can be accessed via http://sonarhost:9000. Use default credentials admin/admin to login. It is best practice to update / install the required plugins. Visit Administration -> Marketplace to find plugins .
Add Projects to SonarQube
Maven Sonar Plugin
The simplest way to run sonar analysis on a maven project is to run the following maven command from the project’s root pom.xml directory.
mvn clean install sonar:sonar -Dsonar.host.url=http://<sonarhost>:9000 -Dsonar.login=<sonar_login>
Note that sonar_login should be created beforehand from within UI. In order to generate the login id goto Administration->Security>Users. Under tokens tab click on config button against the Administrator User. Enter the name of the token and click generate.
Use the generated token as sonar_login in the maven command. Once the maven successfully completes, the project is submitted to SonarQube for analysis. Depending on the size of project it may take sometime before the project analysis report can be viewed.
A sample project overview page looks like below
The page provides a high level view of different reports like bugs, code smells, coverage and duplication.