Description
When using maven.install
via bzlmod in the root module, any bazel_dep
which also uses maven.install
(with the default repository name) can create duplicate artifacts/conflicts.
For instance, when including a bazel_dep for protobuf 21.7 , the following message is logged:
The maven repository 'maven' is used in two different bazel modules, originally in '' and now in 'protobuf'
This happens because protobuf does a maven.install
using maven
as the repository name pinning various common dependencies
This is maybe benign in and of itself, but it can create artifact conflicts. For example, pinning different versions of mockito
/guava
/etc to the root module, the following messages are logged:
Found duplicate artifact versions
com.google.guava:guava has multiple versions 32.0.0-jre, 31.1-jre
org.mockito:mockito-core has multiple versions 5.3.1, 4.3.1
It's possible to work around this by using a separate name
for maven.install
, but it is quite annoying (since you need to set repository_name
everywhere) and likewise incredibly difficult to understand where these duplicates were introduced. In my case, I wasn't even directly importing protobuf
in my root module, but transitively through another bazel_dep, so this was incredibly confusing.
Is there a better way to understand and resolve these conflicts?
Activity