Multi-module project in eclipse gives "Path must include project and resource name"

I have trouble including another project as a dependency in Eclipse.
Example projects can be downloaded here: http://ge.tt/4YWISIZ2

This worked fine yesterday before I updated two eclipse plugins: buildship 1.0.11 and Google Plugin for Eclipse 3.9.
But I have tried with buildship 1.0.10 which worked yesterday.
And I have tried with an eclipse where Google plugin is not installed at all.

The example project I am using works fine when using gradle on the command line. I can compile the dependency Project A just fine when building Project B.

ProjectB depends on ProjectA and therefore includes ProjectA in its settings.gradle
In Eclipse this generates an error with the given stacktrace below.

workspace
β”œβ”€β”€ ProjectA
β”‚   β”œβ”€β”€ bin
β”‚   β”œβ”€β”€ build
β”‚   β”œβ”€β”€ build.gradle
β”‚   β”œβ”€β”€ gradle
β”‚   β”œβ”€β”€ gradlew
β”‚   β”œβ”€β”€ gradlew.bat
β”‚   β”œβ”€β”€ settings.gradle
β”‚   └── src
β”œβ”€β”€ ProjectB
β”‚   β”œβ”€β”€ bin
β”‚   β”œβ”€β”€ build
β”‚   β”œβ”€β”€ build.gradle
β”‚   β”œβ”€β”€ gradle
β”‚   β”œβ”€β”€ gradlew
β”‚   β”œβ”€β”€ gradlew.bat
β”‚   β”œβ”€β”€ settings.gradle
β”‚   └── src
└── RemoteSystemsTempFiles


ProjectA settings.gradle
--------------------------------------------------------
rootProject.name = 'ProjectA'
--------------------------------------------------------

ProjectB settings.gradle
--------------------------------------------------------
rootProject.name = 'ProjectB'

include 'ProjectA'
project(":ProjectA").projectDir = new File(settingsDir, "../ProjectA")
--------------------------------------------------------

--------------------------------------------------------
STACKTRACE when refreshing gradle project ProjectB
--------------------------------------------------------
java.lang.IllegalArgumentException: Path must include project and resource name: /ProjectA
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
	at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2069)
	at org.eclipse.core.internal.resources.Container.getFolder(Container.java:201)
	at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations$4.apply(DefaultWorkspaceGradleOperations.java:230)
	at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations$4.apply(DefaultWorkspaceGradleOperations.java:225)
	at com.google.common.collect.Iterators$8.transform(Iterators.java:794)
	at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
	at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:271)
	at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:226)
	at com.google.common.collect.FluentIterable.toList(FluentIterable.java:334)
	at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.getSubProjectFolders(DefaultWorkspaceGradleOperations.java:225)
	at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.markDerivedFolders(DefaultWorkspaceGradleOperations.java:249)
	at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeOpenWorkspaceProject(DefaultWorkspaceGradleOperations.java:158)
	at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeWorkspaceProject(DefaultWorkspaceGradleOperations.java:130)
	at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeGradleProjectWithWorkspaceProject(DefaultWorkspaceGradleOperations.java:120)
	at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.atomicallySynchronizeGradleBuildWithWorkspace(DefaultWorkspaceGradleOperations.java:86)
	at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.access$000(DefaultWorkspaceGradleOperations.java:59)
	at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations$1.run(DefaultWorkspaceGradleOperations.java:67)
	at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:729)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2241)
	at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5409)
	at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5366)
	at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeGradleBuildWithWorkspace(DefaultWorkspaceGradleOperations.java:64)
	at org.eclipse.buildship.core.workspace.SynchronizeGradleProjectJob.runToolingApiJobInWorkspace(SynchronizeGradleProjectJob.java:77)
	at org.eclipse.buildship.core.util.progress.ToolingApiWorkspaceJob$1.run(ToolingApiWorkspaceJob.java:79)
	at org.eclipse.buildship.core.util.progress.ToolingApiInvoker.invoke(ToolingApiInvoker.java:55)
	at org.eclipse.buildship.core.util.progress.ToolingApiWorkspaceJob.runInWorkspace(ToolingApiWorkspaceJob.java:76)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

------------------------------------------------------------
Gradle 2.12
------------------------------------------------------------

Build time:   2016-03-14 08:32:03 UTC
Build number: none
Revision:     b29fbb64ad6b068cb3f05f7e40dc670472129bc0

Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_74 (Oracle Corporation 25.74-b02)
OS:           Windows 7 6.1 amd64

------------------------------------------------------------
Eclipse
------------------------------------------------------------
eclipseBuildId      4.5.2.M20160212-1500
eclipseProduct      org.eclipse.epp.package.jee.product
javaRuntimeVersion  1.8.0_74-b02
osgiWs              win32
osgiOs              Windows7
osgiOsVersion       6.1.0
osgiArch            x86_64

-------
Eclipse BUNDLES
-------
name                org.eclipse.buildship.core
version             1.0.11.v20160328-1759

name                org.eclipse.core.jobs
version             3.7.0.v20150330-2103

name                org.eclipse.core.resources
version             3.10.1.v20150725-1910

name                org.eclipse.core.runtime
version             3.11.1.v20150903-1804

name                org.eclipse.jdt.core
version             3.11.2.v20160128-0629

name                org.eclipse.jdt
version             3.11.2.v20160212-1500

Thank you for the report. This is a known issue and has been fixed with Buildship 1.0.12 today.

1 Like

BTW, don’t put another settings.gradle in projectA. Only your root project (in this case projectB) should have a settings.gradle.