Connected mode setup

Setting up connected mode and sharing your connection with your team is the easiest way to get started with using the Sonar Solution to bring SonarQube's AI capabilities into your IDE.

Connection setup

SonarQube for IntelliJ provides a connection wizard to help you set up connected mode with SonarQube (Server, Cloud). Follow the SonarQube Server instruction when connecting to SonarQube Community Build:

Automatic setup with SonarQube Server

SonarQube Server and SonarQube Community Build offer the easiest way to set up connected mode: simply use the Opening issues in the IDE feature from SonarQube Server. You must trust the SonarQube Server instance to store a token for the connection, and it’s best if you already have the project open in your IDE.

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

Create a new SonarQube Server Connection

Choose SonarQube Server and add your server details to set up your connection with SonarQube for IntelliJ.

1. Open your IntelliJ Settings…, find the Tools > SonarQube for IDE entry, and select + to open the connection wizard.

2. Enter a name for this connection. When you select SonarQube Server, 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.

3. You will be prompted to add a user Token generated by SonarQube Server. If you don’t already have a token, selecting the Create token button will open the SonarQube Server in your default browser at the URL you provided; here, you can select Generate Token in SonarQube Server. See the Tokens page in SonarQube Server for more information.

User tokens are required when setting up Connected Mode between SonarQube Server and SonarQube for IDE. Note that binding will not function properly if SonarQube Server project tokens or global tokens are used during the setup process.

The final steps involve binding your local project to the project on the server.

Note that logging in with your Username + Password was available in previous versions of SonarQube for IntelliJ to create a connection setup with SonarQube Server. If you used this method in a previous version and then updated SonarQube for IntelliJ, you will need to reauthenticate your connection using a user token.

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 SonarQube for IDE will automatically receive a notification to bind the project. Each team member must use their own project credentials and SonarQube for IDE 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 (Server, Cloud) connection.

Configure your binding

Bind your project

Once connected mode is established, you must bind your IDE project to a SonarQube (Server, Cloud) project.

Select "Bind project to SonarQube (Server, Cloud)" to start the next step in setting up connected mode.

1. Open IntelliJ > Settings… and find the Tools > SonarQube for IDE > Project Settings entry (shown above).

2. Select Bind project to SonarQube Server/SonarCloud and choose the previously created connection name in the dropdown list

3. Enter the project key as it is configured on SonarQube Server/SonarCloud. You can also select it by using Search in list…:

You can enter your Project key directly into the field, or use the search function to find it in a list of projects in your SonarQube (Server, Cloud) Organization.

You will receive a notification that the binding is successful.

Lastly, follow the Save and share your setup: Recommended for teams instructions below to save the project configuration for the rest of the team.

Bind using shared configuration

When opening a new project in IntelliJ, SonarQube for IDE will check for a shared binding configuration file and notify users.

  • Select Use configuration in the notification to open the connection wizard. SonarQube for IDE will pre-populate the connection wizard with the binding configuration and you will be asked to verify the server connection.

If no connection exists, SonarQube for IDE will ask you 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 (Server, Cloud) 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

Some projects may contain multiple shared configuration files. For example, C# projects require a configuration file for each solution, which may be stored in different locations in your directory depending on the SonarQube for IDE IDE used to create the shared configuration files.

When you open projects at the root level, SonarQube for IDE can find all of the configurations. In contrast, if you open a solution folder in Rider for example, SonarQube for IDE will only see the configuration files within the solution.

Sharing configurations between different IDEs

SonarQube for IDE 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 SonarQube for IDE does not send you a notification to accept a shared configuration, please check first if you have opened your project’s root. If SonarQube for IDE still does not suggest a matching configuration, you must configure binding manually. Please see the Configure your binding collapsible above for instructions.

Project binding

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

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

Override binding for modules

In IntelliJ, additional modules can be imported into a project, for example, via the Project Structure menu. This is often used for example to group together the back-end and the front-end parts of an application into the same project. As those components might be analyzed separately, SonarQube for IntelliJ lets users bind modules to different projects.

1. In the IntelliJ settings, find the Tools > SonarQube for IDE > Project Settings entry. Alternatively, you can select the Configure SonarQube for IDE tool icon from any of the SonarQube for IDE view windows to access the Project Settings menu.

2. Make sure a binding is configured at the project level (see the previous section). Note: this will be the default binding for all modules that have no overridden binding.

3. In the ‘Override binding per module’ section, click on the + sign and choose the module.

Your overridden modules will be included when saving and sharing your connected mode setup. See the Reuse the binding configuration collapsible above, for more details.

SonarQube for IntelliJ gives you the option to override your binding module, if you want.

Troubleshooting connected mode

See the Troubleshooting page for details to look at when your SonarQube for IDE analysis does not match what you see in SonarQube (Server, Cloud).

SonarQube for IDE-SonarQube version support policy

SonarQube for IDE enables users to establish a connection to the latest SonarQube Server version and to the latest LTA (Long-Term Active) version. When a new LTA version is released, we still enable connecting SonarQube for IDE to the previous LTA version for a certain period of time (currently 9 months after the latest LTA release) to allow enough time for organizations to update their SonarQube Server version.

For more information about long-term support of SonarQube Server, check out our page describing the SonarQube Server Release cycle model. Review your SonarQube for IDE-specific requirements for version-to-version differences.

Learn more

Check out the main Connected mode page to learn more about the benefits of using connected mode, information about SonarQube for IDE’s branch matching strategy, and how to activate and deactivate your Sonar Smart Notifications in the IDE.

Last updated

Was this helpful?