Multi projects do not work in Eclipse Buildship Plugin

I´m using Eclipse 442 and Buildship plugin 1.0.5. I´ve imported a working multi project structure into Eclipse using the Buildship import wizard. The imported project seems to work fine (means they build), but I was observing the following issues:

  • The buildship plugin creates a “technical” Eclipse project for the imported project containing only a .settings folder with a gradle.prefs file as well as a .project file. All other files / folders from the root of the multi project structure (.gradle, gradle, build.gradle, gradlew.*, settings.gradle) still remain in the root of the workspace. In Eclipse these files and folders are not visible and thus not editable. Another problem is that such files / folders can not be checked in from within Eclipse because it does not support files beeing at the root of the workspace (only project folders)

  • When doing a Gradle > Refresh Gradle project the following exception occurs:
    org.eclipse.buildship.core.GradlePluginsRuntimeException: Cannot create Eclipse project gradledemo. at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceOperations.createProject(DefaultWorkspaceOperations.java:159) at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.addNewEclipseProjectToWorkspace(DefaultWorkspaceGradleOperations.java:226) at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeNonWorkspaceProject(DefaultWorkspaceGradleOperations.java:193) at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeGradleProjectWithWorkspaceProject(DefaultWorkspaceGradleOperations.java:109) at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeGradleBuildWithWorkspace(DefaultWorkspaceGradleOperations.java:70) at org.eclipse.buildship.core.workspace.SynchronizeGradleProjectJob.runToolingApiJobInWorkspace(SynchronizeGradleProjectJob.java:71) at org.eclipse.buildship.core.util.progress.ToolingApiWorkspaceJob$1.run(ToolingApiWorkspaceJob.java:74) at org.eclipse.buildship.core.util.progress.ToolingApiInvoker.invoke(ToolingApiInvoker.java:61) at org.eclipse.buildship.core.util.progress.ToolingApiWorkspaceJob.runInWorkspace(ToolingApiWorkspaceJob.java:71) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by: org.eclipse.core.internal.resources.ResourceException: Resource '/wsp_gradledemo5' already exists. at org.eclipse.core.internal.resources.Resource.checkDoesNotExist(Resource.java:320) at org.eclipse.core.internal.resources.Resource.checkDoesNotExist(Resource.java:307) at org.eclipse.core.internal.resources.Project.assertCreateRequirements(Project.java:52) at org.eclipse.core.internal.resources.Project.create(Project.java:287) at org.eclipse.core.internal.resources.Project.create(Project.java:269) at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceOperations.createProject(DefaultWorkspaceOperations.java:144) ... 10 more
    From now on the files from the “technical” project folder (that Buildship created) are removed and the Gradle nature is gone (means no Gradle > Refresh Gradle project is available anymore, which is necessary when adding new dependencies.

So now my question is, how can I work with multi project configurations within Eclipse and Buildship? Is there an example / tutorial or any advice how to get this working?

The first thing is that Buildship imports all Gradle projects from a build including the root project (I suppose this is what you call a technical project). Also, the partial partial import is not supported, meaning that you should have all projects imported in the workspace.

As of the invisible files, we’ll soon replace the resource filters with the traditional Eclipse filtering. With that you’ll have the option to make the files visible.

The multi-project setup should work just fine in Buildship. If you prefer to store your files in the workspace location (an external location is also supported), here how it should look like:

workspace-folder
|-gradledemo
  |-build.gradle
  |-settings.gradle
  |-module1
    |-build.gradle
  |-module2
    |-build.gradle

The first thing is that Buildship imports all Gradle projects from a build including the root project (I suppose this is what you call a technical project). Also, the partial partial import is not supported, meaning that you should have all projects imported in the workspace.

This is correct, after the import everything works fine.

As of the invisible files, we’ll soon replace the resource filters with the traditional Eclipse filtering. With that you’ll have the option to make the files visible.

This is good news. When will it be released?

The multi-project setup should work just fine in Buildship. If you prefer to store your files in the workspace location (an external location is also supported), here how it should look like:

This is exactly what I wanted to show with my post. It is NOT working, because when I try to do an “Update Gradle Project” after the import it fails with the previously posted exception. And using this update mechanism is necessary - as far as I understood - every time new dependencies are added to the build file. My impression is that this is a bug in the buildship plugin because nothing has been changed after the Gradle import.

My project setup is the following: 3 Eclipse projects. Project 1 and 2 depend on Project 3. No project specific build files, just one central build file.

By the way the workspace structure you recommended is not possible for me. I need module 1 and 2 as separate Eclipse projects.

For this case I think an example would be the most helpful. Would it be possible that you create a simplified version of your project and attach it to this forum entry? Then we can analyse the problem and get back to you faster.

Here is the example to reproduce the described effect.

  1. Unzip file in a folder (e.g. test)
  2. Open folder “test” in Eclipse
  3. Import projects via Gradle buildship plugin => Subfolder “test” is created, build files still remain in root
  4. Start “Refresh Gradle project” on created subfolder for the gradle project (“test”) => Error occurs “subfolder ‘/test’ already exists”

Eclipse version: 4.4.2
GWT Plugin 2.7.0 => But not necessary to see the effect

demo.zip (82.5 KB)

Are there any news about the issue?