我使用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"
}问题的原因应该是什么,我该如何解决呢?
发布于 2018-08-30 11:21:03
在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。
PS我会结束这个问题作为一个重复,而不是再次回答,但我不能这样做,直到有一个表决的https://stackoverflow.com/a/52095596/14379。
https://stackoverflow.com/questions/52093724
复制相似问题