使用gradle-groovy,可以进行带有许多参数(组,名称,版本,ext,分类器)的自定义配置:
configurations {
explode
}
dependencies {
explode (group: 'org.apache.samza', name: 'samza-shell', ext: 'tgz', classifier: 'dist', version: "$SAMZA_VERSION")
}
但是我不知道如何用kotlin-dsl做到这一点。我试过了:
val explode by configurations.creating
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
dependencies {
explode(mapOf(
"group" to "org.apache.samza",
"name" to "samza-shell",
"ext" to "tgz",
"classifier" to "dist",
"version" to "0.13.1"
)
)
}
老实说,为了简洁起见,我宁愿使用字符串插值。
同样,使用groovy,还传递了
Map
的实例。