Reputation: 36
I have a gradle (libgdx) project with the following modules
- :core
- :a
- :b
I'm also including libraries locally as source, to modify them and because they're loosely tied to the project. These projects each have their own structure much like the one for the root project. The final project structure looks like this:
- :core
- :a
- :b
- :libA:core
- :libA:a
- :libA:b
- :libB:core
- :libB:a
- :libB:b
My question is now, how do I correctly set it up so that i can use project(':core')
as project dependencies inside of the nested library projects, and still refer to not the :core
of the root project but to the respective library core modules?
I do not want to modify the dependencies to be like project(':libA:core')
because that would break the library projects in their standalone form.
Upvotes: 0
Views: 401
Reputation: 36
That's not possible as pointed out by M.Ricciuti due to core modules depending on library modules
Upvotes: 0
Reputation: 12096
You could organize the project like that:
/rootDir
-settings.gradle
-/core
-- build.gradle
-/a
-- build.gradle
-/b
-- build.gradle
-/libA
-settings.gradle
-/core
-- build.gradle
-/a
-- build.gradle
-/b
-- build.gradle
-/libB
-settings.gradle
-/core
-- build.gradle
-/a
-- build.gradle
-/b
-- build.gradle
Details:
settings.gradle
at the root level, that includes core, a and b projectssettings.gradle
in libA directory, that includes core, a and b projects from libAsettings.gradle
in libB directory, that includes core, a and b projects from libBThis will work if you don't need to reference the "main" code project from the different libA and libB sub-modules.
Upvotes: 1