Unable to bind project to sonarcloud from Eclipse

Hi All,

I have issues binding sonarlint to my project on sonarcloud from Eclipse.
I am unable to successfully locate my project in the “Choose SonarQube/SonarCloud project” dialog. My project is a private project within a organization.
I do not observe exceptions or failures in logs only the “ProjectNotFoundException” when entering the project key manually. It looks like the plugin do not search within my organization. I am able to manually call the search api with the organization parameter and successfully get my project in the search result.
Anybody have experience with something like this?

Regards,
Jess

Eclipse: 4.8.0
Sonarlint: 4.1
OS: Windows 10

Hi,

I have the same problem with Eclipse 4.12 / SonarLint for Eclipse 4.1.0.201901311043
I can connet to SonarCloud, but none of my projets are found for binding (private projects on an organization)

(OS : Windows 10 or Linux, same problem)

Thx
Julien

Hi, thank you for your feedback.

I just tried to reproduce with Eclipse 2019-06 (4.12.0) and the latest SonarLint (4.1.0.201901311043) on Linux and got it to work - and I have to admit that even with a good knowledge of the ecosystem, I did not find it straightforward. And for the record, yes we do have private projects on SonarCloud - eating our own dogfood :wink:

I tried to write a step-by-step guide below since I did not find any available online, neither here nor on the official website; at the very least, it should give us a basis for investigation.

If I understand correctly, your private projects don’t appear at step 11 - can you please confirm?

Thanks!

Step-by-step guide below

1 - Right click on your project in the Project Explorer, find the “SonarLint > Bind to SonarQube or SonarCloud…” menu

2 - Select SonarCloud, then “Next”

02-bind

3 - Input your user token (generated on server side in your user security settings)

03-token

4 - Start typing your organization key

04-org-empty

5 - Completion shows a popup to confirm that you have selected the right organization

6 - Choose a connection name

06-save-server

7 - Choose whether to receive events (e.g quality gate changes) or not

07-events

8 - Add local projects to bind to the server

08-add-button

9 - Select the projects to configure - at this point, only your workspace projects should be listed

09-local-projects

10 - Next…
10-projects-next

11 - Start typing to see a list of candidate projects (public / private)

11-project-completion

12 - Select a project key, and… Finish (finally!)

12-finish

Hi I have the same issue and it is related to Private Projects on sonarcloud.io. With public projects on sonarcloud it works perfect.

When I enter manually the project key I got

Unable to update SonarLint binding data for project ‘XXXX_XXXXXXX’ on ‘sonarcloud’
Project with key ‘XXXX_XXXXXXX’ not found on SonarQube server (was it deleted?)

XXXX_XXXXXXX (had to mask our org and project)

with intellj and sonarlint the same private project works.

Is there a fix planned or already available on a milestone update site?

SonarLint for Eclipse 4.1.0.201901311043 org.sonarlint.eclipse.feature.feature.group SonarSource

Spring Tool Suite 4
Version: 4.2.2.RELEASE
Build Id: 201905232009

Hi Robert, thank you for your feedback.

We are trying to understand what could explain the difference between the behavior we observe and the one reported in this thread, so I think it is a bit premature to talk about planning/releasing a fix.

One thing that looks suspicious to me is the error message that you mention:

Project with key ‘XXXX_XXXXXXX’ not found on SonarQube server (was it deleted?)

This error message is only used when the provided organization key is null, and this parameter is required when connecting to SonarCloud. You should see the following error message instead:

Project with key ‘XXXX_XXXXXXX’ in organization ‘YYYY’ not found on SonarQube server (was it deleted?)

I am suspecting an issue with the persistence of server-related preferences, could you please check the contents of file: <workspaceDir>/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.sonarlint.eclipse.core.prefs? You should see something like below:

eclipse.preferences.version=1
servers/SonarCloud%2F<yourorgkey>/auth=true
servers/SonarCloud%2F<yourorgkey>/notificationsEnabled=true
servers/SonarCloud%2F<yourorgkey>/org=<yourorgkey>
servers/SonarCloud%2F<yourorgkey>/url=https\://sonarcloud.io
1 Like

Hi,

Thanks for answering. In my case after I paste my authentication token the screen “SonarQube Server Organization” is never shown - no matter if I choose connectiontype sonarcloud or sonarqube. So I cannot choose organization. Could this behaviour be related to some setting on sonarcloud that I missed?

Best regards,
Jess

1 Like

Hi, same as Jess here : I do not have the “SonarQube server organization” page.

When modifying config file to indicate the organization (Via .metadata/.plugins/org.eclipse.core.runtime/.settings, I see all my organization’s projects.

The problem seems to be with the configuration interface of the connection to SonarCloud.

Thx
Julien

1 Like

Hi, I had the exact same issue, and manage to resolve it by adding manually the line
servers/SonarCloud%2FXXX/org=XXX
in the settings file mentionned by Jean-Baptiste

So for me this is a bug of the SonarLint eclipse plugin, not adding this line.
Note: As Jess, the screen to enter the organisation was not shown, which may be the cause

Hi @lecousin

I think I understand the issue.
To confirm, could you please open the following URL in your web browser (after login in to SonarCloud):
https://sonarcloud.io/api/organizations/search?member=true. I expect you will only be a member of one single organization. The screen would appear if you were a member of more than one organization.
I created a ticket: https://jira.sonarsource.com/browse/SLE-315

Hi Julien,

Yes I have a single organisation, here is the output of the URL:
{“organizations”:[{“key”:“lecousin”,“name”:“Guillaume Le Cousin”,“description”:"",“url”:"",“avatar”:“https://avatars3.githubusercontent.com/u/63363?v=4",“alm”:{“key”:“github”,“url”:“https://github.com/lecousin”,“personal”:true},“actions”:{“admin”:true,“delete”:true,“provision”:true},“subscription”:“FREE”}],“paging”:{“pageIndex”:1,“pageSize”:100,"total”:1}}

Guillaume

Thanks for the confirmation. Fix is in progress, will be in the upcoming release of SonarLint for Eclipse.