I have a gradle project with many submodules called shared-library .
I have a project called service , which depends on one of the shared-library modules. for example, it depends on :shared-library:module1 . I usually get this maven dependency.
Now I want to modify the shared-library and check my changes using a dependent project. Instead of modifying the shared-library , creating, deploying to maven, and then restoring my service , I would instead like the service to depend directly on the shared-library gradle project.
So, I found that you can point gradle to arbitrary project directories in the file system:
service /settings.gradle
include "shared-library" project(":shared-library").projectDir = new File("/projects/shared-library")
But when I do this, the project does not know about the shared-library submodules. I can not do it:
service /build.gradle
compile( project(":shared-library:module1"), )
So, I tried include directly. :shared-library:module1 depends on :shared-library:module2 , so I also included it:
service /settings.gradle
include "shared-library" project(":shared-library").projectDir = new File("/projects/shared-library") include "shared-library:module2" include "shared-library:module1"
But now, when I try to run this, it complains that :shared-library:module1 cannot find a project named :module2 . This is due to the fact that its dependency is configured as such:
shared library / module 1 / build.gradle
compile( project(":module2") )
But if I change this to the absolute path of the project, now the shared-library cannot compile on its own:
shared library / module 1 / build.gradle
compile( project(":shared-library:module2") )
tl; dr , there seems to be a discrepancy between how service resolves shared-library submodule names and how shared-library does it.