How can i “provision” the SonarLint-Eclipse Plugin for an existing workspace?

dear all, please consider

  • an eclipse IDE-installation including the sonarlint-plugin
  • an eclipse-workspace with some (30+)already existing projects
  • a current Sonarqube server instance which matching projects for each Workspace-Project
  • a wish to bind each Workspace-Projects sonarlint-setup to the Sonarqube-Project
  • a security-token existing in Sonarqube setup for the user that wants to work with this setup

How can i automate the necessary workspace-setup-actions that bind the workspace-projects to sonarqube-server-projects?

For example: how to setup/manipulate the files create/manipulate the files

  • [ECLIPSE_INSTALL_DIR].metadata.plugins\org.eclipse.core.runtime.settings\org.sonarlint.eclipse.ui.prefs
  • [EACH_ECLIPSE_WORKSPACEPROJECT_DIR].settings\org.sonarlint.eclipse.core.prefs

so that noone needs to manually configure 30+ Projects to bind to the right sonar-project-names etc.

Please do not suggest something like autobinding, that is still a manual process which needs not only be done for every project once but also you need to find the right project name if you have multiple project_key-candidates to select from

//edit: I also would like to add the sonarqube-server configuration by editing the Eclipse-Installation and not as a manual process … if that is possible it would be very nice to be able to do that

If that is not possible currently … i would very humbly like to ask for guidance concerning any other possibly existing way how to ease this setup procedure for the developer.

cheers daniel

Hi Daniel,

You should be looking at Eclipse Oomph which can help you automate the installation and setup of your workspace. You can add the SonarLint plug-in as a requirement, list all your projects in a project set to be automatically checked out from source control, and adapt the configuration files as required, etc.

We have added org.sonarlint.eclipse.core.prefs to source control with the reference to the project and module on Sonar. The Sonar server is also pre-defined.

The only manual process left is for our end users to generate their token on the Sonar server and enter it once in Eclipse.



Thank you for your reply, @Philippe_Cade !

I am sorry to be so late to answer your answer, but it definitely looks like something i might be able to accomplish.

I will gladly mark your reply as an answer … but, if i may humbly ask, would/could you be of help in creating the content which i will need to feed to oomph?

I am still getting my feet wet (and am currently lacking the time to further experiment) with oomph … so i would be glad to be able to ask you here in this thread as a Reply. This would probably also make this thread more whole.

(just to point it out: i ment, i would like to - in the future - use this thread to ask you about uncertainties i probably will be having when further experimenting with oomph and sonarlint)

You should try one of the many tutorials on Oomph available out there. These will get you going quickly.

As discussed in this thread this manual process is even too much for some members of our team. It would be great if something could be improved.

As for the suggestion with Oomph, I do not see any possibility to automate the connection to the SonarQube Server right now.

  1. The server management is in a separated view (and not in the general workspace preferences), I can not use the Oomph pref recorder to record and replay this configuration across the team workspace.
  2. It would be great to have a specific Oomph setup task to configure the SonarQube server (in a similar way that you can define that you would like to query your issue-tracker as part of the Oomph setup script).
  3. As alternative, could you provide an hint where the server-setup is stored? Is that a file in the .metadata folder of the workspace?
    => I am ready to investigate even nonofficial API to perform the setup.

The server connection metadata are stored in the Eclipse instance scope. It means that if you have multiple workspaces, you don’t have to configure the server again and again.

I’m sorry I don’t know OOMPH in details, but I remember it was possible to record server preferences with the old workspace mechanics plugin.

Also, if you are packaging a custom Eclipse bundle in your company, you can provide a plugin_customization.ini to automatically provision the server.

The only thing missing is the ability to provide a token. Since it is stored in the secure storage, I’m not sure it is possible to automate that. So users will need to edit the server connection to set a token.

The preferences for Oomph are:

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0"
1 Like

Quick update on this topic.

For me, the files storing the configs are stored inside the workspace folder, under <workspace>/.metadata/.plugins/org.eclipse.core.runtime/.settings/:

  • File 1: org.sonarlint.eclipse.core.prefs
  • File 2: org.sonarlint.eclipse.ui.prefs

File 1 contains the list of SonarQube servers, the keys contains the server id, as used later in the .settings/org.sonarlint.eclipse.core.prefs file of the projects (the serverId entry). The keys looks like this:

  • servers/<severId-value>/auth
  • servers/<severId-value>/notificationsEnabled
  • servers/<severId-value>/url

File 2 contains user-interface settings, for example if you disable the display of the SonarLint console when there is an error. Something you would have to do like this:

Based on this information, I added this class to our plugin (part of our company distribution of Eclipse):


import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.ui.IStartup;
import org.osgi.service.prefs.Preferences;

public class UpdatePrefs implements IStartup {

	public void earlyStartup() {
		try {
			final IEclipsePreferences uiPrefs = InstanceScope.INSTANCE.getNode("org.sonarlint.eclipse.ui");
			uiPrefs.put("showConsole", "never");

			final IEclipsePreferences corePrefs = InstanceScope.INSTANCE.getNode("org.sonarlint.eclipse.core");
			final Preferences servers = corePrefs.node("servers");
			final Preferences server = servers.node("");
			server.put("auth", "true");
			server.put("notificationsEnabled", "false");
			server.put("url", "");

		} catch (final Exception e) {

Registered in the plugin.xml of our plugin:


Of course you can probably do the same with plugin_customization.ini or with Oomph as explained by Philippe_Cade in the previous message.

I am still investigating how I can set the token for this server (putting something into the secure store). I think this can also be achieved programmatically.