I’m very excited to see that Gradle provides and promotes new, better and cleaner ways of sharing build configuration and logic between modules. That means version catalogs and convention plugins (
buildSrc). However, it confuses me as these two features, which seem to be two complementary parts of the same functionality, are actually incompatible with each other.
We can import
buildSrc, but catalog will be only available in
build.gradle.kts and not in conventions plugins where we really need it. I read Cédric Champeau’s posts here and here. There is a way to access version catalog in plugins, but it seems more like a workaround. We don’t get type-safe accessors which kills the idea and makes
Deps.kt approach just much more convenient. Also, Cédric says that one of advantages of version catalogs over
Libs.kt is that we don’t need to recompile everything on each version change. But if we plan to import version catalogs into
buildSrc then I guess we have exactly the same problem.
So my question are:
- What is the current/future recommended approach for sharing both build logic and dependencies at the same time?
- Do version catalogs apply only to use cases when we need to share dependencies, but don’t need to share anything else?
- Are there plans to make both features closer, more compatible with each other? I’m aware version catalogs is incubating feature, so maybe it just needs time