Part 1 : Sonar Setup

sona

Sonar Setup

Sonar Server Configuration

Please follow below steps to configure the Sonar Server locally

Step 1: Download the SonarQube Community Edition from https://www.sonarqube.org/downloads/
Step 2: Unzip it, let’s say in C:sonarqube

Step 3: Start the SonarQube Server:
# On Windows, 

execute: C:sonarqubebinwindows-x86-xxStartSonar.bat
# On other operating systems, 
execute: /opt/sonarqube/bin/[OS]/sonar.sh console
Step 4: Once the Sonar server is up, you can access the server with default port 9000 and credentials as admin/admin
link: http://localhost:9000/projects

After login, you will see below the screen with empty projects :

sonar

Setting up a security token:
We need to generate the token which will be used by mvn projects to push the sonar reports to our server. generally, we follow this step to make sure that only authentic users push their sonar reports on our server.
1. Go to My Account
2. Navigate to Security
3. Enter the token name something like team name or project name and then click on the Generate button.

sonar2B2
sonar2B3

Copy this newly generated token for future purpose and store it somewhere as you will not be able to get it back from here.

Let’s go to our next tutorial where we will discuss below points :

– Integrate the JaCoCo plugin in the maven project
– Use JaCoCo reports to get Code Coverage
– Integrate JaCoCo Plugin with Sonar to push the Code Coverage