Jenkins Android Gradle构建时间下载错误



使用jenkins android gradle项目来构建错误

* What went wrong:
A problem occurred configuring project ':app'.
> Could not download glide.jar (com.github.bumptech.glide:glide:3.7.0)
   > Could not get resource 'https://jcenter.bintray.com/com/github/bumptech/glide/glide/3.7.0/glide-3.7.0.jar'.
      > Could not GET 'https://jcenter.bintray.com/com/github/bumptech/glide/glide/3.7.0/glide-3.7.0.jar'.
         > repo.jfrog.org: unknown error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

我尝试使用WGET下载链接的方法会引起错误,然后我使用sudo成功下载链接。因此,如何使Jenkins Gradle也使用Sudo下载或使用其他解决方案

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.1'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'me.tatarka:gradle-retrolambda:3.2.5'
        classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
    // Exclude the version that the android plugin depends on.
    configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}
allprojects {
    repositories {
        jcenter()
        mavenCentral()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

请帮助我,谢谢。

您可以尝试将本地库(在用户/.gradle/Caches中)上传到Jenkins Server,它对我有用。

我不认为使用超级用户权利运行构建是一个很好的解决方案,因为似乎不可能解决依赖关系。

只是一个建议方法:Gradle具有自己的本地缓存,用于依赖关系,并且不需要在每个构建上下载它们。因此,您可以使用Jenkins使用的相同的Gradle发行版,一旦手动使用SU权利构建应用程序,就可以解决所有依赖关系并缓存它们。

只是指出,默认情况下,带有动态版本的依赖项仅被缓存24小时,正如官方文档中所说,您可以将其更改为:

configurations.all {
    resolutionStrategy.cacheDynamicVersionsFor 10, 'minutes'
    resolutionStrategy.cacheChangingModulesFor 4, 'hours'
}

最新更新