我的Kotlin项目无法解决Travis-CI的依赖关系

时间:2016-05-02 14:49:53

标签: gradle jvm travis-ci kotlin

我试图将我的Kotlin项目与Travis-CI集成,无法生成成功的构建,我得到的信息是我的gradle找不到存储库...

存储库位于我的文件build.gradle

version '1.0-SNAPSHOT'

buildscript {
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.0-beta-4584"
    }
}

apply plugin: 'java'
apply plugin: 'kotlin'

sourceCompatibility = 1.5

repositories {
    mavenCentral()
    maven {
        url "http://repository.jetbrains.com/all"
    }
}

dependencies {
    testCompile 'org.spek:spek:0.1.188'
    compile "org.jetbrains.kotlin:kotlin-stdlib:1.0.0-beta-4584"
    testCompile group: 'junit', name: 'junit', version: '4.11'
}

我的travis非常简单

language: java

收到的信息是

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'dojo-s01e01-cheque-por-extenso'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Cannot resolve external dependency org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.0-beta-4584 because no repositories are defined.
     Required by:
         :dojo-s01e01-cheque-por-extenso:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED

构建链接是 - > https://travis-ci.org/castrolol/dojo-s01e01-cheque-por-extenso.kotlin/builds/127235950

1 个答案:

答案 0 :(得分:3)

添加

repositories {
     mavenCentral()
}

也适用于buildscript { ... }范围。

另外,考虑使用较新的Kotlin版本,可以找到最新的版本here