Skip to content

Using maven as the repo name causes duplicate warnings when using bzlmod #16839

@jschaf

Description

@jschaf

Downstream bug in rules_jvm_external: bazel-contrib/rules_jvm_external#916

What version of protobuf and what language are you using?

v23.1

What did you expect to see

A clean build when using bzlmod.

What did you see instead?

DEBUG: $TMP/external/rules_jvm_external~/private/extensions/maven.bzl:154:14:
The maven repository 'maven' is used in two different bazel modules,
originally in '<my_workspace>' and now in 'protobuf'

Summarizing @shs96c in bazel-contrib/rules_jvm_external#916 (comment)

The common maven repo name allows rulesets to contribute to the user's JARs. However, this implies that maven is for the end user, not for transitive dependencies. If a ruleset needs private dependencies, it should use a custom namespace rather than the maven namespace.

Proposed fixes

There are a few ways to fix the logline:

  1. Patch protobuf in the Bazel Central Registry rewrite maven to protobuf_maven.
  2. Modify the protobuf repo to rewrite maven to protobuf_maven.
  3. Fetch the JARs manually without using Maven or rules_jvm_external. Trims the dependency graph a fair bit.

I think 2 is the best short-term option. If you're open to it, I can send a PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions