bazel-contrib / rules_jvm_external

Bazel rules to resolve, fetch and export Maven artifacts
Apache License 2.0
336 stars 256 forks source link

bzlmod: Not found error when using version from BOM #1217

Closed SanjayVas closed 2 months ago

SanjayVas commented 3 months ago

I upgraded to rules_jvm_external v6.2 and attempted to try out #1162 by specifying a BOM and dropping the version for artifacts from that BOM. I get errors like that following when attempting to repin:

INFO: repository @@rules_jvm_external~~maven~unpinned_maven' used the following cache hits instead of downloading the corresponding file.
 * Hash '2b78bfdd3ef13fd1f42f158de0f029d7cbb1f4f652d51773445cf2b6f7918a87' for https://github.com/coursier/coursier/releases/download/v2.1.8/coursier.jar
If the definition of 'repository @@rules_jvm_external~~maven~unpinned_maven' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'rules_jvm_external~~maven~unpinned_maven':
   Traceback (most recent call last):
    File "/usr/local/google/home/sanjayvas/.cache/bazel/_bazel_sanjayvas/b471b3a2d1215b70045d7f5bfa478e3e/external/rules_jvm_external~/private/rules/coursier.bzl", line 989, column 38, in _coursier_fetch_impl
        dep_tree = make_coursier_dep_tree(
    File "/usr/local/google/home/sanjayvas/.cache/bazel/_bazel_sanjayvas/b471b3a2d1215b70045d7f5bfa478e3e/external/rules_jvm_external~/private/rules/coursier.bzl", line 922, column 13, in make_coursier_dep_tree
        fail("Error while fetching artifact with coursier: " + exec_result.stderr)
Error in fail: Error while fetching artifact with coursier:
 [##########]   Downloaded 999 POM files in 4 s
Resolution error: Error downloading org.apache.beam:beam-runners-direct-java:
  not found: https://repo1.maven.org/maven2/org/apache/beam/beam-runners-direct-java//beam-runners-direct-java-.pom
Error downloading org.apache.beam:beam-runners-spark:
  not found: https://repo1.maven.org/maven2/org/apache/beam/beam-runners-spark//beam-runners-spark-.pom
Error downloading org.apache.beam:beam-sdks-java-core:
  not found: https://repo1.maven.org/maven2/org/apache/beam/beam-sdks-java-core//beam-sdks-java-core-.pom

BOM: org.apache.beam:beam-sdks-java-bom:2.45.0

I am using bzlmod.

SanjayVas commented 2 months ago

Updating the title as this happens even when not using pinning.

SanjayVas commented 2 months ago

It turns out the issue was that I wasn't using resolver = "maven". Of course, now I hit #1205 instead when trying to switch to that resolver.