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.
Join the DZone community and get the full member experience.Join For Free
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.
Check the Java configured on your local pc.
Step 2: Download the Eclipse sonarLint plugin
Eclipse->help->Eclipse MarketPlace->Type sonarLint ->click install (Restart eclipse after it has been installed successfully).
To run sonarLint automatically, enable the checkbox under project properties. It helps developers to highlight errors and bugs while writing code.
Select the SonarLint console to view the sonarLint log.
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.
- To view issues, click the SonarLint On-The-Fly tab.
- To view the Rule Description:
- Right-click and select Rule description.
- Rule description
Steps to Configure an Eclipse Project in a SonarQube Centralized/Local Server
Download related software and configure it to your local machine:
Unzip sonarqube-6.7 and sonar-scanner-220.127.116.118-windows in your local directory under the sonar main directory.
Set environment variables for sonar-scanner-18.104.22.1688-windows.
Create the project in the SonarQube server by editing the sonar-scanner.properties file under D:\Development\Sonar\sonar-scanner-22.214.171.1248-windows\conf directory.
- Run sonarqube-6.7 server.
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.
- Run SonarScanner to map the project in the SonarQube server.
- Login to the SonarQube web server with a default link:
- Default credentials : admin/admin
Bind an Eclipse project with a SonarQube project by clicking:
Project ->SonarLint->Bind to sonarQube Project
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:
- Pass the SonarQube server URL and click Next.
- 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.
- After Auto bind, selecte your project.
- Run the SourceQube analyzer by clicking the Analyze button.
Opinions expressed by DZone contributors are their own.