Hi everyone,
I’ve migrated our company’s projects to use Gradle for dependency management and build tasks. I am basically happy with it, but there are some problems arising as we are nearing production use.
Our Project Structure:
Project A (A library used by all other projects)
Project B (Depends on A, C, D, E, F)
Project C (Depends on A)
Project D (Depends on A)
Project E (Depends on A)
Project F (Depends on A and D)
Project G (Depends on A, B, C, D, E, F, G)
…
Project B and G are building .war files that are deployed. Project C is both a deployable .jar and a library. The other projects are basically libraries.
Every project lives in it’s own Git repository and uses it’s own build.gradle (and settings.gradle) file. I am using dependency substitution to either resolve the project locally (if present) or resolve it via our internal repository. It is important to be able do co-develop the projects (use recent changes from one project in another without deploying to a repository).
With recent errors I am kinda thinking my Gradle approach is missing something. I am able to build everything fine, but at runtime there are sometimes problems with dependencies (e.g. NoSuchMethodErrors with slf4j, as nearly every project or one of it’s dependencies needs it - forcing versions alone does not help). Another strange thing is that a dependency used in Project B is resolved from Project C (but I guess that’s how multi-project-builds work?). Sometimes there are multiple versions of a dependency in the lib folder of the built .war file. Resolution strategy “force” does not seem to work, but “exclude” does. But if I exclude to much, some projects cannot be built due to missing dependencies.
What is the correct approach in this case? I think our projects are “too much” connect with each other (or not enough?). I’ve tried composite builds, but this is limited by the rule that composite builds may not be part of other composite builds (e.g. Project F is part of Project B). I hope that someone is able to point me into the right direction.
Thanks!
Ps: I’ve recently joined the company and therefore had no part in the initial development of the projects and project structure. I don’t know if i am able/allowed to change the basic project structure.