1

I am trying to understand a bit of internals of bazel jvm external. The bazel documentation was not clear enough for me to understand.

What is the difference between the following steps.

Step 1
maven_install(
  # artifacts, repositories, ...
  maven_install_json = "//:maven_install.json",
)

This step internally calls coursier.bzl to fetch dependencies over @bazel_tools//tools/build_defs/repo:http.bzl

Step 2

    load("@maven//:defs.bzl", "pinned_maven_install")
    pinned_maven_install()

This step appears to be calling @bazel_tools//tools/build_defs/repo:http.bzl without going through coursier.bzl

Questions What is the difference between step 1 and step 2, both appear to be fetching artifacts over HTTP ? Eg: Is step 1 fetching unpinned version only and step 2 fetching pinned version only ?

JavaDeveloper
  • 5,320
  • 16
  • 79
  • 132

1 Answers1

2

You can refer to the following code documentation from def.bzl.

Providing the maven_install_json property instruct maven_install rule to construct two repositories - one for the unpinned artifacts (first invocation) and one for the pinned artifacts (second invocation).

Later, on the second step, loads the pinned artifacts from the pinned artifacts repository. You can see the rule being generated here.

Shmulik Klein
  • 3,754
  • 19
  • 34
  • So what is the difference between unpinned artifacts vs pinned artifacts ? Do they overlap or they are disjoint set of artifacts ? – JavaDeveloper Aug 20 '21 at 03:28
  • They are disjoints sets. Unpinned artifacts show up when you update your dependencies and don't update your `maven_install.json` by repinning - all the artifacts which aren't part of `maven_install.json` will be considered unpinned. – Shmulik Klein Aug 24 '21 at 08:32