带有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
的实例。