bazel-contrib / bazel-contrib/rules_jvm_external
fetching jar from private maven repository fails with 403
- Dominant language
- Java
- Stars
- 373
- Forks
- 301
- Avg merge
- 7d 17h
- Merged PRs (30d)
- 3
Description
I am trying to build a simple java project. Some of the dependencies are kept in a private maven repository.
My WORKSPACE looks like this:
```
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "3.2"
RULES_JVM_EXTERNAL_SHA = "82262ff4223c5fda6fb7ff8bd63db8131b51b413d26eb49e3131037e79e324af"
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_deps",
artifacts = [
"org.projectlombok:lombok:1.18.12",
"mygroup:myartifact:version"
],
repositories = [
"https://repo1.maven.org/maven2",
"https://username:password@my.repo.io/artifactory/repo",
],
)
```
My BUILD looks like this:
```
java_library(
name = "mylib",
srcs = glob([
"proj/src/main/java/**/*.java"
]),
deps = [
"@maven_deps//:org_projectlombok_lombok",
"@maven_deps//:mygroup_myartifact",
],
)
```
When i run `bazel build //:mylib` the fetching of mygroup:myartifact:version from the private maven repository fails with http error code 403. I hardcoded the username and password for simplicity. The username used is an email so i encoded it, e.g.: `me%40gmail.com`.
I am using bazel version 3.1.0.
Passing the username and password through env vars produced the same error.
Fetching the same jar using curl works great:
```
curl -O 'https://me%40gmail:PASSWORD@my.repo.io/artifactory/repo/mygroup/myartifcat-version.jar'
```
Can anyone see what the problem is?
Thank you in advance!
Contributor guide
Research direction
Start by reproducing `bazel build //:mylib` with the `WORKSPACE` `maven_install` configuration and the private repository URL, then compare its authentication handling with the documented `curl` request. The issue is done when `mygroup:myartifact:version` can be fetched from the private repository and the `mylib` target builds successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100