Gradle custom repositories and dependency resolution
Asked Answered
P

1

8

A project I'm developing requires scribe-java and crashlytics libraries. Both libraries are available from custom repositories.

build.gradle looks like:

buildscript {
    repositories {
        maven { url 'http://download.crashlytics.com/maven' }
    }

    dependencies {
        classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
    }
}
apply plugin: 'android'
apply plugin: 'crashlytics'
repositories {
    // is required by Crashlytics library
    maven { url 'http://download.crashlytics.com/maven' }
    // is required by Scribe library
    maven { url 'https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/' }
}

....

dependencies {

    compile 'com.android.support:support-v4:+'

    compile 'com.crashlytics.android:crashlytics:1.+'
    ...
    // OAuth/OAuth2
    compile 'org.scribe:scribe:1.3.6'
    ...
}

With such a setup repository resolution gets jumbled during the build process such that gradle tries to resolve artifacts from inapropriate repositories:

Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/]
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/]

It tries to retrieve crashlytics files from scribe repository.

Permalloy answered 8/5, 2014 at 13:50 Comment(1)
I'm also unable to reach the declared repository. Did you ever resolve this?Supervisor
I
0

Repositories are searched for in their declared order, until the dependency is found. If the crashlytics library is searched for in the scribe repository, it means that it wasn't found in the crashlytics repository.

Iny answered 8/5, 2014 at 16:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.