How can I dynamically share and update Maven artifact versions across multiple MODULE.bazel files using Bzlmod? #27386
-
🧩 Title:How can I dynamically share and update Maven artifact versions across multiple MODULE.bazel files using Bzlmod? 📝 Description:Hi Bazel team 👋 I’m currently working in a large Bazel monorepo where we use Bzlmod and Both define Maven repositories and should stay in sync automatically. 💡 What we’ve tried so far
❓ The questionIs there an officially supported or recommended way in Bzlmod to:
Essentially:
⚙️ Context
But Bazel currently doesn’t seem to allow reading a generated repo in another module file in the same evaluation phase. 💬 Expected outcomeA supported pattern (or documentation reference) for sharing dynamically generated data (like Maven versions) between multiple Would this be possible through:
🙏 Thank youAny guidance or official example on this kind of multi-MODULE shared state in Bzlmod would be greatly appreciated. —
Would you like me to make it slightly shorter and more “GitHub issue” friendly (i.e. fewer explanations, more condensed)? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
|
Given that .MODULE.bazel no longer supports load(), what is the recommended pattern in Bzlmod for: Specifically: How can multiple module files reference the same dynamically generated repository (e.g., @versions_repo) or shared version constants, when Bazel’s module evaluation model prevents load() and same-phase repo access? |
Beta Was this translation helpful? Give feedback.
-
|
In the latest One property that this has is that there are many tools that understand the format of this file, and can do useful things like automatically update dependencies. |
Beta Was this translation helpful? Give feedback.
-
|
Would https://bazel.build/rules/lib/globals/module#include help with your use case? |
Beta Was this translation helpful? Give feedback.
In the latest
rules_jvm_externalrelease, we added support for reading dependencies from a Gradle version catalog. This can be accessed using from_toml tag. That sounds like it'd be the right fit for this problem.One property that this has is that there are many tools that understand the format of this file, and can do useful things like automatically update dependencies.