bazel-contrib / bazel-contrib/rules_jvm_external

Add flag for turning off transitive closure expansion for maven_install

Open
#540 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
373
Forks
301
Avg merge
7d 17h
Merged PRs (30d)
3

Description

I'm starting to see a need on my project for requiring all dependencies to be explicitly declared rather than automatically getting transitive dependencies pulled in by maven_install. While the transitive closure support is nice for smaller projects, it can introduce headaches in larger projects:
- It can result in Android Studio picking the wrong dependency version when multiple are available in the build graph, but not all through Maven (I ran into this with protobuf today with no obvious workaround)
- It can result in one-version violations since the dependency resolution seems to only work for the Maven dependency graph, whereas other parts of the build graph may be introducing common dependencies with different versions (which means that mixed source/Maven dependency graphs don't play well together despite the former being recommended as a [Bazel best practice](https://docs.bazel.build/versions/master/best-practices.html#depending-on-binaries))
- It makes auditing the full list of third party dependencies harder

It seems like the ``strict_visibility`` argument gets us slightly closer in that it avoids unintentionally depending on the wrong version in project code, but it doesn't prevent Maven dependencies themselves from pulling in incorrect versions.

Contributor guide

Open the contributing guide

Research direction

Start at the maven_install entry point and compare the requested option with strict_visibility. Determine where transitive closure expansion is configured, then establish coverage for explicit dependencies when that expansion is disabled; done means the new behavior is tested and its interaction with Maven dependency resolution is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.