rules_jvm_external icon indicating copy to clipboard operation
rules_jvm_external copied to clipboard

Equivalent of maven's dependencyManagement for steering resolution of transitive deps

Open robertgates55 opened this issue 3 years ago • 1 comments

I'm looking to migrate our multi module maven project to bazel. Have hit a bit of a snag around transitive dependencies though that I'd love some advice on.

In my maven parent pom.xml, we specify a number of <dependencyManagement><dependencies> that don't actually have any corresponding <dependencies> in child poms, but that are used by the reactor to steer the resolution of transitive deps. In some cases (eg quarkus-universe) these are <type>pom</type> deps, that actually explode out to 1000s of artifacts.

In maven_install is there any way to provide such a hint without simply defining it as an artifact? I've successfully just copied the dependencyManagement list and added it to the artifacts in the maven_install list, but on one of my projects I'm then hitting issues with the sheer number of artifacts that this creates for resolution - when the chances are most of the jars aren't actually used/needed. (https://github.com/bazelbuild/rules_jvm_external/issues/549 is the related issue for what happens when trying to pin a list of 3500 artifacts)

robertgates55 avatar Apr 19 '21 08:04 robertgates55

We've hit this issue too, we currently use version_conflict_policy = "pinned" and specify them as regular dependencies, but it does mean they can be depended on, which is not what we want.

uri-canva avatar Jul 01 '21 06:07 uri-canva