Skip to content

Rename maven to protobuf_maven in MODULE.bazel (#18641)#19477

Merged
zhangskz merged 1 commit into29.xfrom
cp-29-maven
Dec 2, 2024
Merged

Rename maven to protobuf_maven in MODULE.bazel (#18641)#19477
zhangskz merged 1 commit into29.xfrom
cp-29-maven

Conversation

@zhangskz
Copy link
Member

@zhangskz zhangskz commented Dec 2, 2024

Cherry-pick of 44660b3 to fix #19451

The default name for the rules_jvm_external.maven rule is "maven". When not set, it defaults to "maven". For root modules also using rules_jvm_external, the name clash causes a warning:

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 1:

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.

Since protobuf is not contributing to user's JARs, we'll use a custom namespace. There's precedent for using a custom namespace for library modules:

  • rules_jvm_external uses rules_jvm_external_deps instead of maven.
  • rules_kotlin uses kotlin_rules_maven instead of maven.

Fixes #16839.

Closes #18641

COPYBARA_INTEGRATE_REVIEW=#18641 from jschaf:joe/protobuf-maven bd2c62f PiperOrigin-RevId: 684625084

The default name for the rules_jvm_external.maven rule is "maven". When not set, it defaults to "maven". For root modules also using rules_jvm_external, the name clash causes a warning:

```
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 [1]:

> 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.

Since protobuf is not contributing to user's JARs, we'll use a custom namespace. There's precedent for using a custom namespace for library modules:

- rules_jvm_external uses `rules_jvm_external_deps` instead of `maven`.
- rules_kotlin uses `kotlin_rules_maven` instead of `maven`.

[1]: bazel-contrib/rules_jvm_external#916 (comment)

Fixes #16839.

Closes #18641

COPYBARA_INTEGRATE_REVIEW=#18641 from jschaf:joe/protobuf-maven bd2c62f
PiperOrigin-RevId: 684625084
@zhangskz zhangskz requested a review from a team as a code owner December 2, 2024 18:31
@zhangskz zhangskz requested review from deannagarcia and sbenzaquen and removed request for a team December 2, 2024 18:31
@zhangskz zhangskz enabled auto-merge (squash) December 2, 2024 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants