Single project to manage multiple libraries

Hello all
Right now we are having many common libraries in our organization. We are managing that in fashion 1 git repo = 1 gradle project. Thanks to that we are publishing all libraries independently. Than if libraries are connected, we just add them as dependecies.

Our approach is getting very time consuming for us and we would like to move one repo+ one gradle project for all our libraries, but still publish multiple libraries from single repo.

Let’s assume we are maintaining 5 libraries A B C D E.
A is without dependencies to other libs and won’t be used as dependecy
B is without dependencies to other libs and will be used as dependecy
C and D are using library B
E is using library D

so we would have structure like that

So my goal is

  1. We have 1 repo with 1 gradle project, where I can store 5 libraries, run ./gradlew check to verify them. I would like to be able to update all project locally without need to publish them first.
  2. When I am happy with outcome, I would like to release all 5 libraries as independent publishes.

Is idea like that aligned with Gradle? I could not see ready example, so before we dig into it, maybe thare are some docs/suggestions?

NOTE: Support not circular dependency obviously is not needed.

Thx for help

You can have all projects in one Gradle build and still release them individually, yes.
On publication the metadata will use the coordinates for the dependencies.

But you can also keep the projects in one per Gradle build and then use composite build feature to compose the builds, so the builds for C and D would includeBuild the B build.

You could also have some logic like “if B is there in directory ../B then includeBuild it, otherwise not” or similar, so that if B is not there the published version is used but if it is there, the composite build is used.

You can read more about composite builds at Composite Builds