Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repository resolution failure will fail build #49

Closed
steeve opened this issue Feb 22, 2019 · 2 comments
Closed

Repository resolution failure will fail build #49

steeve opened this issue Feb 22, 2019 · 2 comments

Comments

@steeve
Copy link

steeve commented Feb 22, 2019

Given the following:

    maven_repository_specification(
        name = "android_core_deps",
        artifacts = {
            "io.reactivex.rxjava2:rxjava:2.2.6": {"insecure": True},
        },
        repository_urls = [
            "https://bintray.com/bintray/jcenter",
            "https://maven.google.com",
            "https://repo1.maven.org/maven2",
        ],
    )

It will fail with:

INFO: Invocation ID: 24e5f05d-e5bd-4884-a716-567a7ad0330b
INFO: SHA256 (https://bintray.com/bintray/jcenter/io/reactivex/rxjava2/rxjava/2.2.6/rxjava-2.2.6.pom) = 98acc4b930c5c5d6a140ee22caa04f226645238c8ada543c9e9293d5935b6ec4
ERROR: Analysis of target '//android:publish_snapshot' failed; build aborted: no such package '@android_core_deps//io/reactivex/rxjava2': Traceback (most recent call last):
	File "/private/var/tmp/_bazel_steeve/309ac22c92b055a3e3f78825fe63406b/external/maven_repository_rules/maven/maven.bzl", line 192
		_get_dependencies_from_pom_files(ctx, artifact)
	File "/private/var/tmp/_bazel_steeve/309ac22c92b055a3e3f78825fe63406b/external/maven_repository_rules/maven/maven.bzl", line 143, in _get_dependencies_from_pom_files
		_get_inheritance_chain(ctx, _fetch_pom(ctx, artifact))
	File "/private/var/tmp/_bazel_steeve/309ac22c92b055a3e3f78825fe63406b/external/maven_repository_rules/maven/maven.bzl", line 122, in _get_inheritance_chain
		poms.parse(xml_text)
	File "/private/var/tmp/_bazel_steeve/309ac22c92b055a3e3f78825fe63406b/external/maven_repository_rules/maven/poms.bzl", line 228, in poms.parse
		xml.parse(xml_text)
	File "/private/var/tmp/_bazel_steeve/309ac22c92b055a3e3f78825fe63406b/external/maven_repository_rules/maven/xml.bzl", line 267, in xml.parse
		fail(("Unbalanced xml tree: closing t...)))
Unbalanced xml tree: closing tag </head> incorrectly matched with <meta> in xml
<!doctype html>
<!--[if IE 9]><html class="lt-ie10" lang="en" ><![endif]-->
<html class="no-js" lang="en">

That is because https://bintray.com/bintray/jcenter/io/reactivex/rxjava2/rxjava/2.2.6/rxjava-2.2.6.pom doesn't exist. Perhaps it should gracefully go to the other repo ?

@cgruber
Copy link
Collaborator

cgruber commented Feb 23, 2019

This isn't an error of "nothing there" - this is an error that you asked for the .pom file and got an html file instead.

This is a bit of a tricky one, as this isn't really in the control of the rules. What's happening here is that bintray returns a page at that address, but that page isn't the actual pom file. Given that the rules hand off downloading of all the urls to the bazel repository_ctx object, and it does all the downloading, it's returning a bad file. We have no way to tell it it's wrong, and to re-download from a different URL. From the repository_ctx object's perspective, it successfully downloaded the file.

So the question is: why is bintray returning an html file here instead of a 404 error or the real file... I suspect you're actually hitting a login authentication page. That's not something that the bazel maven rules have any control over, or even any way to recover from. I would dig in and see if you're dealing with authentication problems here. When I try to go to that page, I don't get a 404 error, I get a login page for bintray.

So this is probably more related to #47. On that note, the problem is broader, as the heir to maven_jar inside bazel (maven_jvm_import_external) also doesn't support this, as there's no particular mechanism available to skylark rules to supply credentials to the repository_ctx.download() method. (cf. bazelbuild/bazel#7443)

that said, before I close this, can you verify if you're having an authentication failure?

@cgruber
Copy link
Collaborator

cgruber commented Feb 26, 2019

Closing, as this isn't really an issue with the current feature set, and is kind of a dupe of #47.

@cgruber cgruber closed this as completed Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants