I'm working on migrating our project to Bazel.
WORKSPACE
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "2.10"
RULES_JVM_EXTERNAL_SHA = "1bbf2e48d07686707dd85357e9a94da775e1dbd7c464272b3664283c9c716d26"
http_archive(
name = "rules_jvm_external",
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
sha256 = RULES_JVM_EXTERNAL_SHA,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
)
load("@rules_jvm_external//:defs.bzl", "maven_install")
maven_install(
name = "maven",
artifacts = [
"com.foo:bar:1.0.0-SNAPSHOT"
"org.apache.commons:commons-lang3:3.9",
],
repositories = [
"https://our-maven-repo",
],
resolve_timeout = 200,
fail_on_missing_checksum = False,
fetch_sources = True
)
BUILD
java_library(
name = "our-name",
srcs = glob([
"src/main/java/**/*.java"
]),
resources = glob([
"src/main/resources/**",
]),
deps = [
"@maven//:com.foo_bar",
"@maven//:org.apache.commons_commons-lang3"
],
)
When I run:
PS> bazel fetch //:our-name
Output
INFO: Call stack for the definition of repository 'maven' which is a coursier_fetch (rule definition at C:/users/name/_bazel_name/73nyktky/external/rules_jvm_external/coursier.bzl:620:18):
- C:/users/name/_bazel_name/73nyktky/external/rules_jvm_external/defs.bzl:89:5
- C:/project/WORKSPACE:19:1
INFO: Repository 'maven' used the following cache hits instead of downloading the corresponding file.
* Hash '8f35f92fb8e021f96b3aa8145c66c3b2e29295baabb28ff50569e613438afcbd' for https://github.com/coursier/coursier/releases/download/v2.0.0-RC3-4/coursier.jar
If the definition of 'maven' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'maven':
Error while obtaining the sha256 checksum of v1/https/our-repo/prod/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar: java.io.IOException: ERROR: src/main/native/windows/process.cc(199): CreateProcessW("python" C:/users/name/_bazel_name/73nyktky/external/bazel_tools/tools/build_defs/hash/sha256.py C:/users/name/_bazel_name/73nyktky/external/maven/v1/https/ourrepo/prod/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar artifact.sha256): The system cannot find the file specified.
(error: 2)
ERROR: C:/project/BUILD:1:1: no such package '@maven//': Error while obtaining the sha256 checksum of v1/https/our-repo/prod/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar: java.io.IOException: ERROR: src/main/native/windows/process.cc(199): CreateProcessW("python" C:/users/name/_bazel_name/73nyktky/external/bazel_tools/tools/build_defs/hash/sha256.py C:/users/name/_bazel_name/73nyktky/external/maven/v1/https/ourrepo/prod/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar artifact.sha256): The system cannot find the file specified.
(error: 2) and referenced by '//:our-name'
ERROR: Evaluation of query "deps(//:our-name)" failed: errors were encountered while computing transitive closure
Loading: 0 packages loaded
org.apache.commons:commons-lang3:3.9 jar does get download, along with a sha1 and md5 hash. The com.foo:bar:1.0.0-SNAPSHOT jar does NOT get downloaded. The sha1 and md5 do get downloaded.
I think my issue is that our repo does not have any sha256 hashes to download so the fetch (or build) fail with that error. However when i look at the actual rules_jvm_external https://github.com/bazelbuild/rules_jvm_external#checksum-verification it seems that sha256 is not mandatory?
Any ideas on what I'm doing wrong?
Bazel 1.1.0 Windows 10 Enterprise, version 1803, OS build 17134.1069
rules_jvm_external
maintainer here.
ERROR: C:/project/BUILD:1:1: no such package '@maven//': Error while obtaining the sha256 checksum of v1/https/our-repo/prod/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar: java.io.IOException: ERROR: src/main/native/windows/process.cc(199): CreateProcessW("python" C:/users/name/_bazel_name/73nyktky/external/bazel_tools/tools/build_defs/hash/sha256.py C:/users/name/_bazel_name/73nyktky/external/maven/v1/https/ourrepo/prod/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar artifact.sha256): The system cannot find the file specified.
This is the real error where Windows' CreateProcessW
is complaining that python
is not available. This is previously reported in this issue as well. We added SHA256 checking in 2.3, and unfortunately this depends on Python.
Do you have python
installed? There is an outstanding PR that drops the dependency here.