简体   繁体   English

如何使用Gradle Kotlin-dsl添加新配置

[英]How to add new configuration with Gradle Kotlin-dsl

with gradle-groovy it is possible to create a new configuration with: 使用gradle-groovy可以创建一个新的配置:

configurations {
    explode
}

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

But I don't know how to do that with the kotlin-dsl. 但我不知道如何用kotlin-dsl做到这一点。 I tried: 我试过了:

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)
}

but without success. 但没有成功。 Any ideas? 有任何想法吗?

Could you please try: 你可以尝试一下:

val explode by configurations.creating

or: 要么:

val explode = configurations.create("explode")

The following build.gradle.kts script works fine: 以下build.gradle.kts脚本工作正常:

repositories {
    mavenCentral()
}

val explode by configurations.creating

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM