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



使用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("org.apache.samza:samza-shell:0.13.1")
}

相关内容

  • 没有找到相关文章

最新更新