代码之家  ›  专栏  ›  技术社区  ›  Hleb

Travis CI生成失败:无法解析网址:org.jetbrains.kotlin:科特林·格拉德尔-插件:1.2.50[副本]

  •  1
  • Hleb  · 技术社区  · 6 年前

    我使用Gradle构建我的Kotlin项目,并使用travisci进行持续集成。在合并上一个pull请求之后,我发现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”,我可以在浏览器中打开它。这是我的构建.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"
    }
    

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

    1 回复  |  直到 6 年前
        1
  •  2
  •   seanf Channing Walton    6 年前

    这似乎是Travis访问Maven Central时经常遇到的问题。看到了吗 https://github.com/travis-ci/travis-ci/issues/6593 https://github.com/travis-ci/travis-ci/issues/10055

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


    other answer .