Eclipse does not prompt for workspace any more after installing BuildShip

After I installed the BuildShip plugin, Eclipse (Luna) stopped asking me which workspace to open at startup and instead just opens the default workspace. Starting Eclipse with the -clean option temporarily solves the issue, but the problem reappears after some days.
At first I thought that this must be a coincidence, because there seems to be no logical connection between the BuildShip plugin and the workspace chooser. But after experiencing the same behaviour on another machie, I started wondering if this is happening to some of you guys to.

Hello Christoph,

My college Donat and I cannot reproduce this issue on our machines.
The org.eclipse.ui.internal.ide.ChooseWorkspaceData class is responsible for defining this configuration, but in Buildship we never get in touch with this class and we also do not change any Preference of the IDE Scope.
Did you perhaps setup your IDE with the Eclipse oomph installer, because oomph itself does a lot concerning your user preferences.
Could you please give us some insights, which other plugins you are using, so that we can try to reproduce this with an equal setup?

Best regards,

Simon

Hi Simon,

I can easily reproduce this problem on 2 separate PC systems with the exact same configuration. My PCs run Windows 7 Enterprise x64 with Eclipse Mars 4.5 64 bit (Eclise IDE for Java EE Developers), Java 8u51 x64 on one PC and Java 8u60 x64 on the other, Gradle 2.7, and Buildship Eclipse 1.0.3.v20150917-1110. The only other plugin installed beyond Gradle Buildship is SubEclipse used for SVN. On each system I have a large Java project which does not use Gradle and existed long before creating a new project that lives in a separate workspace that uses Gradle.

I recently joined a new team that uses Gradle. No one was running BuildShip so I thought I would give it a try (works great other than this issue so thank you!!!). I checked out the entire project source with Eclipse then deleted the temp project (needed to Checkout via SVN) and .project used for the Checkout from SVN. With Eclipse Mars and BuildShip, I then used Eclipse > File > Import > Gradle Project. The import just points at the root source location with the Add project to working sets selected. Gradle works great and imports everything just fine. As I would need to do without Gradle, several sub projects folders require Apache Tomee libraries added to resolve unknown classes.

I can exit and reenter Eclipse and always get prompted for the Workspace I want to use. Because the project with Gradle was the last used, I am prompted for that workspace directory. Opening Gradle Tasks view I can see the list of tasks to assemble, build, etc… If I exit Eclipse without running any task and rerun Eclipse, Eclipse loads and prompts with the workspace folder for the Gradle project every time.

However, if I execute any task, even just right click Run Gradle Task > for ‘clean’ on a simple project subfolder, then exit Eclipse, when I restart Eclipse I am not prompted for the Gradle project workspace and instead the workspace that does load is the project that does not use Gradle. I’m guessing Eclipse is not happy with something it sees in the cache for the project where a Gradle task was run. Exit and rerun never prompts for the workspace and always loads the project not using Gradle.

If I start with ‘eclipse -clean’ which I guess wipes the Eclipse cache, I get prompted for the workspace folder and interestingly the default prompt is for the Gradle project.

As mentioned I have two separate PCs with the exact same behavior and is 100% reproducible every time after running a Gradle task. It does not seem to matter what task is run. Run a task and the workspace will not be prompted on Eclipse restart.

My original project that does not use Gradle is in C:\Users\Bill\workspace. The Gradle project is in C:\Users\Bill\EntityRuntime. Here is my org.eclipse.ui.ide.prefs that shows Eclipse should prompt for the Gradle project. I’m guessing Eclipse is not happy with something it sees related to the Cache for the Gradle project and loads the non-Gradle Java project instead.

MAX_RECENT_WORKSPACES=5
RECENT_WORKSPACES=C:\Users\Bill\EntityRuntime\nC:\Users\Bill\workspace
RECENT_WORKSPACES_PROTOCOL=3
SHOW_WORKSPACE_SELECTION_DIALOG=true
eclipse.preferences.version=1

I am brand new to Gradle and never had to debug Eclipse. I can try whatever you need or pass along any log files or information. Likely the key is to create a project that does not use Gradle first in one workspace, then create a project that uses Gradle in a separate workspace. Leave Eclipse in the default behavior to prompt for the workspace folder. Load the Gradle workspace project, run a Gradle task, and then exit appears to be the key to reproduce this issue.

Thanks for the help! Maybe we can fix this for Mars 4.5.1!

Regards,
Bill

Hello Simon

Sorry for my late reply, I was lying in bed sick for some days.

My setup:
OS X Yosemite / Windows 7
JDK 1.8 Update 25+
Eclipse 4.4 Luna (Eclipse IDE for Java EE Developers)
Plugin: Maven m2e, Vaadin, JBoss Tools, e(fx)clipse, Minimalist Gradle Editor

Inspired by the post of bill, I also started trying out some scenarios. If I start Eclipse, do nothing and just close it again, it asks me to choose a workspace on the next startup. However, if I do some “Gradle stuff” like calling the clean task, Eclipse will not ask on the next startup.

Regards,
Christoph

Hello Christoph and William,

thank you for giving us further details concerning the workspace prompt issue.
I have been able to reproduce and fix this issue.

So this problem should not occur any more in the latest snapshot build.
You can find the different p2 update sites for Buildship here: https://projects.eclipse.org/projects/tools.buildship/downloads

The p2 update site Snapshot, which includes the fix is this one: http://download.eclipse.org/buildship/updates/e45/snapshots/1.0

Can you please install the latest snapshot and verify that it also works for you?

Thanks in advance and regards,

Simon

Hello Simon,

i tried the linked snapshot, and i think it solves also bug #476522 (at least i can’t reproduce my initially reported bug anymore, but i just don’t know about Ian Stewart’s Problem)

Good work, many thanks for this fix! (Maybe we should go via the forum to report bugs in the future, mine is still unconfirmed :wink:

Kind regards,
Thomas

Hi Thomas

Thanks for the feedback. The fix is now in version 1.0.4, released earlier today.

This week, we will also confirm whether the other bug you mentioned is fixed.

Going through the forum with bugs and problems is in general the recommended way.

Regards, Etienne

Hi Simon and Etienne

I’ve just tried the snapshot version and updated my plugin also via the regular way (using the eclipse marketplace function). It works in both cases.

Thank you very much for your help!

Regards,
Christoph

Hi All,

Thank you for the quick solution. I downloaded BuildShip 1.05 and the problem is gone.

Thank you!
Bill

Hi,

It seems that this problem has reappeard in Buildship 2.0.0.v20170111-1029 running on STS 3.8.3 (Neon 2)

I am able to switch the workspace after start but I am not able to choose it during startup. (Option to ask on startup is activated)

Is anyone able to verify this?

Regards Michael