使用gradle-groovy,可以使用以下命令创建新配置:

configurations {
    explode
}

dependencies {
    explode (group: 'org.apache.samza', name: 'samza-shell', ext: 'tgz', classifier: 'dist', version: "$SAMZA_VERSION")
}

但是我不知道如何用kotlin-dsl做到这一点。我试过了:
val explode by configurations

dependencies {
    explode(group = "org.apache.samza", name = "samza-shell",  ext = "tgz", classifier = "dist", version = samzaVersion)
    // "explode"(group = "org.apache.samza", name = "samza-shell",  ext = "tgz", classifier = "dist", version = samzaVersion)
}

但没有成功。有任何想法吗?

最佳答案

您可以尝试:

val explode by configurations.creating

或者:
val explode = configurations.create("explode")

以下build.gradle.kts脚本可以正常工作:
repositories {
    mavenCentral()
}

val explode by configurations.creating

dependencies {
    explode("rg.apache.samza:samza-shell:0.13.1")
}

关于gradle - 如何使用Gradle Kotlin-dsl添加新配置,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46402188/

10-08 23:25