I have two projects, client
and shared
. Both are Buildship projects and have external dependencies defined and working. Here's my multi project setup:
workspace/
shared/
build.gradle
client/
build.gradle
settings.gradle
workspace/settings.gradle
:
rootProject.name = 'workspace'
include 'client'
include 'shared'
Now I want to sort inter-project dependencies. client
depends on compiled artifacts from shared
. So according to 25.4.3. Project dependencies I think I add the following to client
s build.gradle
:
compile project(':shared')
However I can't compile in Eclipse. If I refresh the client
project I get:
A problem occurred evaluating root project 'client'. Project with path ':shared' could not be found in root project 'client'.
It's like it doesn't recognise it as a multi project build...
I realised that gradle init
had generated a settings.gradle
file inside the two child projects. So I removed those files, but then I get a different error when refreshing either child project (and the project becomes entirely unusable):
Provided eclipse project is not the root project
How to get the two projects to work together, and hopefully just define this once?
Thanks to help here the following should fix it:
client
andshared
projects from Eclipse, leave the files intact on the file systemclient
andshared
inside to a different folder, so the root folder is not also the Eclipse workspace rootThat fixed it for me - inter project dependencies were then resolved.