我有一个android gradle构建,它在四个不同的服务器上查找依赖项。
现在构建需要两分钟,因为每次构建都会检查这些依赖项。 可能发生这种情况是因为其中一个存储库为大多数依赖项返回错误。
我的gradle文件中有以下来源:
repositories {
maven { url 'http://jenkins.local:8081/nexus/content/groups/public/' }
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/'}
maven {url "https://repo.commonsware.com.s3.amazonaws.com"}
}
第一个条目是一个代理,它应该在第一个请求之后缓存所有工件。 这是依赖列表的一部分:
编译'com.android.support:support-v4:19。+'
compile 'com.squareup.picasso:picasso:2.2.+'
compile 'com.commonsware.cwac:merge:1.0.1'
compile files('libs/crittercism_v4_3_0_sdkonly.jar')
testCompile 'junit:junit:4.10'
testCompile 'org.robolectric:robolectric:2.3-SNAPSHOT'
testCompile 'com.squareup:fest-android:1.0.+'
testCompile 'org.mockito:mockito-all:1.9.5'
instrumentTestCompile 'junit:junit:4.10'
instrumentTestCompile 'org.robolectric:robolectric:2.3-SNAPSHOT'
instrumentTestCompile 'com.squareup:fest-android:1.0.+'
instrumentTestCompile 'org.mockito:mockito-all:1.9.5'
现在,在运行gradle时,我得到以下输出(同样是快照):
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/de/greenrobot/greendao/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/support-v4/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/support-v4/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/squareup/picasso/picasso/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/squareup/picasso/picasso/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/squareup/picasso/picasso/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/squareup/picasso/picasso/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/appcompat-v7/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/appcompat-v7/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/mediarouter-v7/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/mediarouter-v7/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/support-v4/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/support-v4/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/fasterxml/jackson/core/jackson-databind/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/fasterxml/jackson/core/jackson-databind/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/fasterxml/jackson/core/jackson-core/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/fasterxml/jackson/core/jackson-core/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/fasterxml/jackson/core/jackson-annotations/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/fasterxml/jackson/core/jackson-annotations/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/squareup/okhttp/okhttp/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/squareup/okhttp/okhttp/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/squareup/retrofit/retrofit/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/squareup/retrofit/retrofit/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/de/greenrobot/greendao/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/de/greenrobot/greendao/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/support-v4/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/support-v4/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/squareup/picasso/picasso/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/squareup/picasso/picasso/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/squareup/picasso/picasso/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/squareup/picasso/picasso/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/appcompat-v7/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/appcompat-v7/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/mediarouter-v7/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/mediarouter-v7/]
Failed to get resource: GET. [HTTP HTTP/1.1 403 Forbidden: https://repo.commonsware.com.s3.amazonaws.com/com/android/support/support-v4/maven-metadata.xml]
如何强制构建每天只执行一次此查找,或者跳过上次失败的查找或者获取找到的第一个工件并跳过已经可用的工件的所有其他存储库?
答案 0 :(得分:1)
这个故事的寓意:确保您的Maven存储库为实际上不存在的任何内容返回404。
在Amazon S3上托管存储库的特定情况下,使用Amazon S3 Manager向“Everyone”授予“List”权限,或者按照this StackOverflow answer中的说明进行操作。