Travis CI构建失败:无法解析org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.50 [重复]

问题描述 投票:1回答:1

这个问题在这里已有答案:

我使用Gradle构建我的Kotlin项目并使用Travis CI进行持续集成。在合并最后一次拉取请求后,我发现Travis CI构建失败了。在日志中我看到下一个:

FAILURE: Build failed with an exception.

> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.50.
     Required by:
         project :
      > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.50.
         > Could not get resource 'https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.50/kotlin-gradle-plugin-1.2.50.pom'.
            > Could not GET 'https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.50/kotlin-gradle-plugin-1.2.50.pom'. Received status code 403 from server: Forbidden

据我所知,Gradle无法获得Kotlin插件,但当我尝试在本地构建项目时,一切都很好(实际上我没有改变任何与构建过程相关的内容)。此外,我检查了提到的文件的可用性 - 'kotlin-gradle-plugin-1.2.50.pom',我可以在浏览器中打开它。这是我的build.gradle配置:

buildscript {
    ext.kotlin_version = '1.2.50'

    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

version '1.' +  System.getProperty("buildNumber")

apply plugin: 'kotlin'

repositories {
    mavenCentral()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

问题的原因应该是什么?我该如何解决?

gradle kotlin continuous-integration travis-ci
1个回答
2
投票

这似乎是特拉维斯访问Maven Central的一个反复出现的问题。见https://github.com/travis-ci/travis-ci/issues/6593https://github.com/travis-ci/travis-ci/issues/10055

建议的解决方法是在sudo: true中使用.travis.yml


PS我会把这个问题作为副本而不是再次回答,但是在other answer投票之前我不能这样做。

© www.soinside.com 2019 - 2024. All rights reserved.