Gradle自定义存储库和依赖项解析

时间:2014-05-08 13:50:11

标签: android gradle android-gradle scribe build.gradle

我正在开发的项目需要scribe-javacrashlytics个库。这两个库都可以从自定义存储库中获得。

build.gradle看起来像:

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'
    ...
}

使用这样的设置存储库解决方案在构建过程中变得混乱,以至于gradle尝试从不适当的存储库中解析工件:

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/]

它尝试从scribe存储库中检索crashlytics文件。

1 个答案:

答案 0 :(得分:0)

以声明的顺序搜索存储库,直到找到依赖关系。如果在scribe存储库中搜索crashlytics库,则意味着它在crashlytics存储库中找不到。