Install Free
Eclipse | Team features | Connected Mode setup

Connected Mode setup

On this page

Connection setup

SonarLint for Eclipse offers a Sonar connection wizard to help you set up Connected Mode; it can be accessed in two different ways:

  • Go to File > New > Other… to open Eclipse’s Select a wizard menu. Then, find SonarLint > New SonarQube/SonarCloud Connection and select Next.
  • Or, Right-click in the SonarLint Bindings tasks view tab and select New Connection…. This method will start the wizard right away.

Choose either SonarCloud or SonarQube, then select the Next button to continue:

Automatic setup

SonarQube 10.4+ offers the easiest way to set up Connected Mode: simply use the Open in IDE feature from SonarQube. You must trust the SonarQube server to store a token for the connection, and it's best if you already have the project open in your IDE. 

Check the Troubleshooting article if something doesn’t work right or follow the instructions below to manually create a SonarQube connection.

Create a new SonarQube Connection

Choose SonarQube and add server details to set up your connection with SonarLint.

1. When you select SonarQube, you will need to enter the server URL before selecting Next to proceed. The default URL is http://localhost:9000, but your URL might differ.

2. Choose your authentication method & authenticate:

  • Token: generate a user token in your SonarQube instance. This is the preferred way to avoid the compromise of your username & password. Clicking the Generate token button will open the https://<your-sonarqube-url>/account/security/ page in your default browser. You can always create a token manually, if needed.
  • Username + Password: this method can be used for a SonarQube connection only. It lets SonarLint use your credentials directly but is not the recommended method due to potential security risks.

3. Enter a Connection name so that you can find it later in the SonarLint Bindings view window, and click Next to continue.

4. Then, choose if you want to receive Notifications; you have the option to allow SonarQube or SonarCloud to send Smart Notifications to the IDE. Smart notifications make you aware of changes made on the server. Finally, select Finish to complete the Connection wizard.

SonarLint will automatically compare the SonarQube server's project list against open projects in your workspace and if you've accepted notifications, SonarLint will suggest a binding. The final step involves binding your local project to the project on the server.

Automatic setup

SonarCloud offers the easiest way to set up Connected Mode: simply use the Open in IDE feature from SonarCloud. You must trust the SonarCloud server to store a token for the connection, and it's best if you already have the project open in your IDE. 

Check the Troubleshooting article if something doesn’t work right or follow the instructions below to manually create a SonarQube connection.

Create a new SonarCloud Connection

Choose SonarCloud and add server details to set up your connection with SonarLint.

1. You will be prompted to add a user Token generated by SonarCloud. If you don't already have a token, clicking the Generate token button will open the https://sonarcloud.io/account/security page in your default browser. Select Next to continue.

2. Start typing the name of your SonarCloud Organization and choose your organization from the filtered list that appears; your Organization Key will automatically populate the field. Select Next to continue.

3. Enter a Connection name so that you can find it later in the SonarLint Bindings view window. Click Next to continue. Connection Name is a friendly name for your connections.

4. Then, choose if you want to receive Notifications; you have the option to allow SonarQube or SonarCloud to send Smart Notifications to the IDE. Smart notifications make you aware of changes made on the server. Finally, select Finish to complete the Connection wizard. 

SonarLint will automatically compare the SonarCloud oganization's project list against open projects in your workspace and if you've accepted notifications, SonarLint will suggest a binding. The final steps involve binding your local project to the project on the server.

First-time connection setup for shared binding

One team member must step through the first-time setup process, then export and commit the binding configuration to the repository. Any team member who opens the project while running SonarLint will automatically receive a notification to bind the project. Each team member must use their own project credentials and SonarLint will use the binding details found in the configuration file to complete the connection.

To begin, one person from the team must follow the steps outlined in Using the connection wizard and Configure your binding, then follow the Save and share your setup instructions below to save the project configuration for the rest of the team. 

Using the connection wizard

Connected Mode setup

Follow the Connection setup instructions above for your SonarQube or SonarCloud connection.

Configure your binding

Bind your project

If you just created a new connection, the connection wizard will transition into a binding wizard where you can add projects that you want to bind. Or, you can select your SQ or SC server in the SonarLint Bindings tab, right-click, and select Bind Projects… to open the wizard, then Add… to open the Project selection window.

  1. The Project selection window presents a list of projects open in the Eclipse workspace. 
  2. In the next window, start typing the name of a project you have on the server; double-click on the matching project, and the wizard will grab and load the Project Key.
  3. Click Finish and check the progress bar in the lower right corner.

You will receive a notification that the binding is successful.

If you want to share your configuration this binding configuration your team, open the Save and share your setup collapsible below for complete instructions.

Save and share your setup: Recommended for teams

Reuse the binding configuration

Export the binding configuration

There are two ways to create a binding configuration file:

  1. Right-click on a connection found in the SonarLint Bindings view and select - Share Binding…
  2. Right-click on a project in the Eclipse Explorer, then navigate to SonarLint and select - Share Binding…

Either method prompts a confirmation window to explain that a configuration file will be created. Once confirmed, a .json file containing the SonarQube URI and Project Key or SonarCloud Organization and Project Key will be added to the .sonarlint folder in your project.

Export binding configurations for a hierarchical directory

SonarLint for Eclipse gives you the ability to export shared binding configurations to match hierarchical project directories.

  • If you right-click on the parent-level project and select Share Binding…,
    • the binding configuration file will be saved at the root project level. 
  • If you right-click on a child-level project and select Share Binding…,
    • choose Save to Project to create a binding configuration file at the child level or, 
    • choose Save to Root Project to create a binding configuration file at the parent level.

Share the binding configuration

Commit the file you just created in the working directory; your teammates should have access to the binding configuration once your commit becomes part of the repository.

Because your Project’s identifying information is saved in a location under source control, it will be available to anyone with access to the project repo. Each team member is still required to have their own SonarQube or SonarCloud credentials; these are managed in SonarQube and SonarCloud, respectively.  

Bind using shared configuration

When opening or adding a new project to the Eclipse Explorer, SonarLint will check for a shared binding configuration file and prompt notify users.

If no connection exists, Sonarlint will ask to create a new connection. Users must provide their own User Token in the Connection Mode setup wizard; selecting the Generate token button will open SonarQube or SonarCloud to step through this process and populate the setup form with your new token.

If a matching connection setup exists, users are asked only to bind the project using the shared binding configuration.

Bind configurations for hierarchical directories

Because Eclipse can have multiple local projects open in the Eclipse Explorer, SonarLint might find multiple shared binding configuration files. When there are multiple combinations, SonarLint will suggest the best match between the local projects and those on the server.

To confirm the project bindings, select the More information link in the notification window to check how SonarLint will map the configuration. If the suggested matches are incorrect, you must configure or reconfigure the bindings manually.

Sharing configurations between different IDEs

SonarLint extensions are available for IntelliJ (and other Jet Brains IDEs), Visual Studio, VS Code, and Eclipse. Although the information stored in the shared configuration file is the same, each extension might export the JSON file to a slightly different location depending on IDE and project type. This may cause friction when opening a configuration in an IDE other than the IDE that created it.

If SonarLint does not send you a notification to accept a shared configuration, please check first if you have opened your project’s root. If SonarLint still does not suggest a matching configuration, you must configure binding manually. Please see the Configure your binding collapsible above for instructions.

Project binding

SonarLint keeps server-side data in local storage and synchronizes with configured servers at startup; one example would be the quality profile defined by your SonarCloud Organization. 

A binding update will automatically be attempted once every hour or after an IDE restart and SonarLint will do its best to synchronize with the most appropriate branch from the server. 

View connections

Connections and their bindings can be retrieved in the SonarLint Bindings view tab which is found by navigating to the File Menu > Window > Show View > Other... > SonarLint > SonarLint Bindings:

Right-clicking on a connection will open a tooltip to edit or delete the connection and can be useful, for example, to update credentials and bindings if they have changed.

You can view and manage your connections and bindings in the SonarLint Bindings view.

Right-clicking on a connection will reveal an option to select Update All Project Bindings.

SonarLint-SonarQube version support policy

SonarLint enables users to establish a connection to the latest SonarQube version and to the latest LTA (Long-Term Active) version. When a new LTA version is released (approximately every 18 to 24 months), we still enable connecting SonarLint to the previous LTA version for a certain period of time (currently 12 months after the latest LTA release) to allow enough time for organizations to upgrade their SonarQube version. 

For more information about long-term support of SonarQube, check out our page describing "what an LTA is" and, to review IDE-specific requirements, please check the respective pages of the documentation as listed in the next paragraph.

⚠️ The 8.9LTA reached its support expiration date (in November ’23).

Learn more

Check out the main Connected Mode page to learn more about the benefits of using Connected Mode, information about SonarLint's branch matching strategy, and how to activate and deactivate your Sonar Smart Notifications in the IDE.


Was this page helpful?

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

Creative Commons License