Having come from the JS world, I’m having difficulty understanding how to best scaffold up some interconnected projects using gradle.
Suppose I have project B, who is nothing other than some google protobuf definitions. I have another project, C, who is also some protobuf definitions. B depends on C. Suppose that another package, A, consumes B. Thus, A transitively consumes C. Note, each of these projects lives in separate repositories.
How to package/publish B is a bit of mystery to me.
- I can bundle C’s source (.proto files) into B. However, this is nasty as I’ve just duplicated C’s code in B. The package payload is higher, and my ability to dynamically satisfy C’s version on a version string greatly reduced, such as if A also has a direct dependency on C.
- I can just ship B as a standalone, but now when A runs, everything blows up because A has no reference to C. Thus, it’s now up to the consumer to traverse its dependencies’ dependencies, add them into A, which is… a headache.
In NPM land, I didn’t publish necessarily a runnable artifact (e.g. a .jar), but instead, a npm digestable package. That package defines it’s deps, and on-install, the package manager recursively fetches all of it’s dependencies recursively.
It would seem that this is something gradle could/should attempt to support as well? I don’t publish an artifact, but rather, a gradle project. My npm
build.gradle. If all I can publish is an artifact, complexity remains high as using a dependency manager hasn’t given me much beyond a download and declarative versioning tool.
this says “Manage transitive dependencies,” but I have no idea how for the above situation. Would love some insight from the gradle wizards out there .