How to Setup Eclipse IDE for Sonar Analysis

This article describes steps required to configure your eclipse for SonarQube such that developers are not required to leave the eclipse IDE to manage their source code quality. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos.
Following are the key points described later in this article:
  • Installing & Configuraing SonarQube in Eclipse
  • Analyzing code using SonarQube


Installing & Configuring SonarQube in Eclipse

Follow the steps given on following pages to install and configure SonarQube in your Eclipse IDE.

  • The page on Installing SonarQube in Eclipse consists of steps required to install SonarQube in the IDE. Once downloaded, it would prompt to restart the Eclipse IDE. For proceeding ahead, you must restart the Eclipse IDE.
  • The page on Configuring SonarQube in Eclipseconsists of steps required to configure Eclipse for SonarQube. The key thing to note is the fact that as you click on Preferences > SonarQube > Servers, you see the default server entry for http://localhost:9000. Initially, as per instruction page, seeing the default entry, I went ahead to next step for linking the project to SonarQube server and run the analysis. However, it throw the error such as Unknowb version of SonarQube server. After a little research, I figured out that the error was thrown as the SonarQube Server was not reachable although I saw it configured as http://localhost:9000. The solution is to go to Preferences > SonarQube > Servers, click “Edit” button and you would see SonarQube Server URL, username and password. The key is to give username and password and run the analysis once again.

 

Analyzing code using SonarQube

Once you are done with installation and configuration of SonarQUbe server in Eclipse IDE, for code analysis, all you need is right click on your project and click SonarQube > Analyze and that is it. The violations would appear in SonarQube analysis as shown in the screenshot below.

sonarqube analysis in eclipse

However, do note that these issues may not appear if you try to access on the browser. For that to happen, you need to once again run “sonar-runner” from the project root.


Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking.

Recent Posts

Agentic Reasoning Design Patterns in AI: Examples

In recent years, artificial intelligence (AI) has evolved to include more sophisticated and capable agents,…

1 month ago

LLMs for Adaptive Learning & Personalized Education

Adaptive learning helps in tailoring learning experiences to fit the unique needs of each student.…

1 month ago

Sparse Mixture of Experts (MoE) Models: Examples

With the increasing demand for more powerful machine learning (ML) systems that can handle diverse…

2 months ago

Anxiety Disorder Detection & Machine Learning Techniques

Anxiety is a common mental health condition that affects millions of people around the world.…

2 months ago

Confounder Features & Machine Learning Models: Examples

In machine learning, confounder features or variables can significantly affect the accuracy and validity of…

2 months ago

Credit Card Fraud Detection & Machine Learning

Last updated: 26 Sept, 2024 Credit card fraud detection is a major concern for credit…

2 months ago