在Gradle Kotlin DSL中使用非正式的Kotlin版本

目前Kotlin的版本还在快速迭代中,如果遇见坑又不得不解决的时候,那么就可能会选择非正式版本来临时解决问题:

以下贴出关键脚本:

gradle.properties:

systemProp.kotlinVersion=1.2.40-eap-62

build.gradle.kts:


val kotlinVersion: String by System.getProperties()

buildscript {
    val kotlinVersion: String by System.getProperties()
    repositories {
        mavenCentral()
        jcenter()
        maven("https://dl.bintray.com/kotlin/kotlin-eap")
    }
    dependencies {
        classpath(kotlin("gradle-plugin", kotlinVersion))
        classpath(kotlin("allopen", kotlinVersion))
        classpath(kotlin("noarg", kotlinVersion))
        classpath("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:$kotlinVersion")
    }
}
apply{
    plugin("kotlin")
    plugin("kotlin-spring")
    plugin("kotlin-jpa")
}

/** End for EAP version **/

plugins {
    val kotlinVersion: String by System.getProperties()
    val springBootVersion: String by System.getProperties()

    ...
    ...

    kotlin("jvm") version kotlinVersion
    kotlin("plugin.spring") version kotlinVersion
    kotlin("plugin.jpa") version kotlinVersion
    kotlin("plugin.allopen") version kotlinVersion
    kotlin("plugin.noarg") version kotlinVersion

    ...
    ...
}

repositories {
    maven ("http://maven.aliyun.com/nexus/content/groups/public")
    mavenCentral()
    maven("https://dl.bintray.com/kotlin/kotlin-eap")
    maven("https://repo.spring.io/milestone")
}

dependencies {
    ...
    ...
    compile(kotlin("stdlib-jdk8", kotlinVersion))
    compile(kotlin("stdlib", kotlinVersion))
    compile(kotlin("reflect", kotlinVersion))
    ...
    ...
}

你可能感兴趣的:(Kotlin,Kotlin,DSL)