abhishek12355/ August 26, 2018/ Java, Linux, Tricks/ 0 comments

Sonar Configuration

Installing SonarQube

Instructions for installing SonarQube can be found in a separate blog Install SonarQube. Visit the link to setup SonarQube.

Configuring 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 Marketplace.

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.

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. sonar-tokens

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.

Project Overview

A sample project overview page looks like below Project Overview

The page provides a high level view of different reports like bugs, code smells, coverage and duplication.

Share this Post

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.