gradle - Travis CI 构建失败 : Could not resolve org. jetbrains.kotlin :kotlin-gradle-plugin:1. 2.50

标签 gradle kotlin continuous-integration travis-ci

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





Grails failed dependencies from Travis CI

(1 个回答)


3年前关闭。




我使用 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"
}

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

最佳答案

这似乎是 Travis 访问 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 进行投票之前我不能这样做。 .

关于gradle - Travis CI 构建失败 : Could not resolve org. jetbrains.kotlin :kotlin-gradle-plugin:1. 2.50,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52093724/

相关文章:

Gradle:ear deploymentDescriptor - 从 application.xml 中排除模块

java - 如何在kotlin中组合两个不同长度的列表?

使用 Circleci 构建的 Android 持续集成失败并出现错误 android ndk 未配置

deployment - GitLab CI - 在无休止的挂起状态中构建项目

java - Kotlin 中 MutableList 成员的索引访问运算符重载

jenkins - 如何测量持续集成服务器 (Jenkins) 的硬件规范?

将 lwjgl 与 gradle 一起使用时出现 java.lang.UnsatisfiedLinkError

java - Intellij外部库中所有类的“Cannot resolve symbol”

gradle - Gradle-配置测试包括从属性文件

json - 使用 WebFlux 从资源中读取和解析文件的 react 方式?