Im trying to build a simple project with bazel. Unfortunately I don’t get through the corporate proxy.
λ bazel build //:my-lib
ERROR: Error computing the main repository mapping: Error accessing registry https://bcr.bazel.build/: Failed to fetch registry file https://bcr.bazel.build/modules/platforms/0.0.9/
MODULE.bazel: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required"
Computing main repo mapping:
I have set HTTPS_PROXY
and HTTP_PROXY
and NO_PROXY
with values of the format
HTTPS_PROXY=http://username:[email protected]:port/
HTTP_PROXY=http://username:[email protected]:port/
NO_PROXY=localhost, 127.0.0.*, 10.*, 192.168.*, some more
I’m sure they are ok, since a number of other tools pick this up and are working fine.
According to the docs bazel should just pick this up: https://docs.bazel.build/versions/0.29.1/external.html#using-proxies
Any ideas to get this working?
WORKSPACE file
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "4.3"
RULES_JVM_EXTERNAL_SHA = "6274687f6fc5783b589f56a2f1ed60de3ce1f99bc4e8f9edef3de43bdf7c6e74"
http_archive(
name = "rules_jvm_external",
sha256 = RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
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(
artifacts = [
"com.fasterxml.jackson.core:jackson-annotations:2.15.0",
"jakarta.annotation:jakarta.annotation-api:2.1.1",
"com.google.j2objc:j2objc-annotations:1.3",
"org.codehaus.mojo:animal-sniffer-annotations:1.20",
"org.checkerframework:checker-qual:3.12.0",
],
repositories = [
"https://repo1.maven.org/maven2",
],
)
BUILD file
java_library(
name = "my-lib",
srcs = glob(["my-lib/src/main/java/**/*.java"]),
resources = glob(["my-lib/src/main/resources/**"]),
deps = [
"@maven//_com_fasterxml_jackson_core_jackson_annotations",
"@maven//_jakarta_annotation_jakarta_annotation_api",
],
)