Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

SonarQube 6.7 Server and SonarLint 3 Eclipse Plugin Installation

DZone's Guide to

SonarQube 6.7 Server and SonarLint 3 Eclipse Plugin Installation

Part of being a performance tester is knowing all the tools at your disposal. Learn how to get a project up and running with this open source testing tool.

Free Resource

Learn how real real-time monitoring is critical for DevOps. Because you can't build what you can't see.

In this article, I will explain the steps to:

       1. Configure SonarQube in Eclipse with the SonarLint plug-in.

       2. Configure an Eclipse project with a SonarQube centralized server/local server.

SonarQube is used for Code Quality Analysis and provides the capability to not only show the health of an application but also to highlight issues newly introduced. With a Quality Gate in place, you can fix the leak and therefore improve code quality systematically.

SonarQube is internally using PMD, Findbugs, CheckStyle, etc. If needed, we can add additional plugins according to our requirements. For Example, we can add JUnit additional plug-ins.

Configuring SolarLint 3.3 Plugin in Eclipse  

Once, sonorLint is configured in Eclipse, it'll help to identify errors or bugs in development phase itself. sonorLint analyzes the source code and if any errors show up in the sonorLint console, the developer will be notified while editing the code.

Step 1:

Check the Java configured on your local pc.

Image title

Step 2: Download the Eclipse sonarLint plugin

Eclipse->help->Eclipse MarketPlace->Type sonarLint ->click install (Restart eclipse after it has been installed successfully).

Image title

Step 3:

To run sonarLint automatically, enable the checkbox under project properties. It helps developers to highlight errors and bugs while writing code.

Project->Properties->sonarLint   

Image title

Step 4:

Select the SonarLint console to view the sonarLint log.

Image title

Step 5:

How do you use the sonarLint report?

  • Every Save, sonarLint Start analyzes the code and the report is shown in the SonarLint-on-the-fly Report tab.

Image title

  • To view issues, click the SonarLint On-The-Fly tab.Image title 
  • To view the Rule Description:
    • Right-click and select Rule description.Image title
    •   Rule descriptionImage title

Steps to Configure an Eclipse Project in a SonarQube Centralized/Local Server

Step 1:

     Download related software and configure it to your local machine: 

        1. sonarqube-6.7

        2. sonar-scanner-3.0.3.778-windows

Step 2:

Unzip sonarqube-6.7 and sonar-scanner-3.0.3.778-windows in your local directory under the sonar main directory.

Image title

Step 3:

Set environment variables for sonar-scanner-3.0.3.778-windows.

Image title

Step 4:

Create the project in the SonarQube server by editing the sonar-scanner.properties file under D:\Development\Sonar\sonar-scanner-3.0.3.778-windows\conf directory. 

Image titleStep 5:

  • Run sonarqube-6.7 server.Image title

Note: The sonarqube-6.7 bin directory contains an (Windows, Linux, Mac) operating system boot file. Refer to the screenshot below. I have run my SonarQube server in windows-x86-64 directory because my PC is 64-bit, You can choose you preference based on your system configuration. Image title

  • Run SonarScanner to map the project in the SonarQube server.Image title
  • Login to the SonarQube web server with a default link:
    • http://localhost:9000
    • Default credentials : admin/adminImage title

Step 6:

Bind an Eclipse project with a SonarQube project by clicking:

Project ->SonarLint->Bind to sonarQube Project

Image title

Click 'Auto bind selected project.' It helps to bind automatically with the SonarQube server. 

Note: We have already created the project name, “JavaProject,” and run the SonarScanner and created the project name in the SonarQube server.

  • Connect to the SonarQube Local server:Image title
    • Pass the SonarQube server URL and click Next.Image title
    • There are two methods to connect to the server. I have chosen to use my username/password and passed default credentials (admin/admin) to pass the test connection.Image title  
    • After Auto bind, selecte your project.Image title
    • Run the SourceQube analyzer by clicking the Analyze button. Image title

    Get real-time alerts and visualizations across your cloud infrastructure for real real-time cloud monitoring. Try it FREE now

    Topics:
    sonarqube ,performance ,eclipse ,code quality ,code analysis

    Opinions expressed by DZone contributors are their own.

    {{ parent.title || parent.header.title}}

    {{ parent.tldr }}

    {{ parent.urlSource.name }}