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

Building an OpenAI Chatbot with LangChain

Have you ever wondered how to use OpenAI APIs to create custom chatbots? With advancements…

10 hours ago

Building a RAG Application with LangChain: Example Code

The combination of Retrieval-Augmented Generation (RAG) and powerful language models enables the development of sophisticated…

1 day ago

How Indexing Works in LLM-Based RAG Applications

When building a Retrieval-Augmented Generation (RAG) application powered by Large Language Models (LLMs), which combine…

5 days ago

Retrieval Augmented Generation (RAG) & LLM: Examples

Last updated: 25th Jan, 2025 Have you ever wondered how to seamlessly integrate the vast…

5 days ago

What are AI Agents? How do they work?

Artificial Intelligence (AI) agents have started becoming an integral part of our lives. Imagine asking…

3 weeks ago

Agentic AI Design Patterns Examples

In the ever-evolving landscape of agentic AI workflows and applications, understanding and leveraging design patterns…

4 weeks ago