Either the forum has record low attendance, or people don’t know the answer. But the question is very simple, by the way.
Although I could not answer the question I asked, I still found a way to solve the problem. If you carefully analyze the project structure, you can see that the subprojects pulls dependencies from the root project, which in turn pulls them from all subprojects. The solution is to turn off transitive dependencies for subprojects.
It’s unorthodox what you’re doing here. Usually, the root project in a multi-module build does not do any compilation
I suggest that you remove your java sources etc from the root project and create a new submodule for them. In my opinion, the root project should not have src/main/java. The root project is just a logical grouping of its subprojects and should only really contain common build logic.
Gradle positions himself as a very flexible build tool that supports any project structure. All documentation is replete with a mention of this. Maybe my project structure is unusual, but the grad must support it.
Yes, Gradle’s very flexible. Yes, it can handle your use case. And yes, you’d be better off putting your sources in their own separate module rather than the root to avoid the “chicken or egg” scenario you’ve already encountered