Install Free
Eclipse | Getting started | Installation

Installation

On this page

For the most part, SonarLint can be installed directly from your IDE's Marketplace. Offline installations are also possible and previous versions are always available if needed.

Instructions

SonarLint for Eclipse is a plugin that can be installed in most Eclipse-based IDEs (including Spring Tool Suite, PyDev, and others). You can find the SonarLint for Eclipse IDE extension directly on the Eclipse Marketplace.

Using the Eclipse Marketplace client

1. In your Eclipse-based IDE, open the Marketplace client.

Go to Help > Eclipse Marketplace... to install SonarLint directly from the IDE.

2. Search for SonarLint, and select Install.

Install SonarLint for Eclipse directly from the Eclipse Marketplace.

3. Restart your IDE.

Using the Eclipse Install New Software wizard

If you can't use the Eclipse Marketplace client, you can still directly access the SonarLint update site. See the official Eclipse documentation for full details, and follow these instructions:

1. Go to Eclipse > Help and select Install New Software.

Go to Help > Install New Software... in the Eclipse file menu to start your SonarLint installation.

2. Select the Add... button to add a new repository pointing to https://eclipse-uc.sonarlint.org. Give the repository a meaningful name. Don't worry if you, can't open this URL in your web browser, Eclipse will automatically look for files compositeContent.xml and compositeArtifacts.xml.

Select Add to enter the SonarLint for Eclipse repository URL.
Add the SonarLint repository URL to the Location field in the Installation Wizard.

3. Select both the newly added SonarLint repository and the SonarLint for Eclipse feature.

Select the SonarLint dependencies and packages to fit your application.

4. Review the features about to be installed, and select Finish.

The last step before finishing your SonarLint for Eclipse installation!

5. When requested, restart your IDE

First taste of SonarLint

Now that you have SonarLint installed, open or create a new project containing source files in a programming language SonarLint can analyze out of the box: Java, PHP, Python, JavaScript or HTML.

For example in Java, you can copy-paste this code snippet, with a typical bug when copy-pasting for loops:

package org.mycompany;

import java.util.logging.Level;
import java.util.logging.Logger;

public class Main {

  private static final Logger LOGGER = Logger.getLogger(Main.class.getName());

  public static void main(String[] args) {
    for (int left = 0; left < 10; left++) {
      for (int right = 0; right < 10; left++) {
        LOGGER.log(Level.INFO, "Pair: ({0},{1})", new Object[] {left, right});
      }
    }
  }

}

If you open this Java file within the Eclipse Java editor, you should see SonarLint reporting the issue:

SonarLint gives you squiggly lines and a ruled line in the sidebar to help call out issues in the Eclipse code explorer.

To get more details about the issue, you can simply hover on the issue location, and a popup will display the issue message:

Hover over an issue found by SonarLint to pull up the issue message and quick fix (when available).

There is also the possibility to use the SonarLint On-The-Fly feature to display the list of issues found by SonarLint. Simply open the view from the menu Windows > Show View > Other.

To open a SonarLint view that isn't showing, go to Windows > Show View > Other > SonarLint and choose your views.
The SonarLint On-The-Fly view shows you issues found in the active file.

Was this page helpful?

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARQUBE, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License