Open lenvonsam opened 5 years ago
@bmuschko Would you be able to provide kotlin-dsl samples as well?
You may have seen that I am actively looking for someone to take on the development of this plugin in the README file. I won't have the time to contribute additional samples in the Kotlin DSL but I'd be more than open to access pull requests if someone wants to take on the work. The Gradle Docker plugin does something similar so a solution could use the same kind of approach.
We tried to use this plugin in kotlin and got this issue:
It fails with a class cast exception in com.bmuschko.gradle.cargo.convention.CargoPluginExtension#deployable:
deployable(delegateClosureOf<Deployable> {
context = "our-deployable"
})
It expects a DeployableClosureDelegate, but got a delegate closure (which is Gradle-Kotlin's strongly-typed variant of Groovy closures). However, com.bmuschko.gradle.cargo.convention.CargoPluginExtension.DeployableClosureDelegate is a private class so we cannot instantiate it.
Try using the Kotlin DSL Groovy Builder, that worked for us.
Try using the Kotlin DSL Groovy Builder, that worked for us.
A limited example workaround using withGroovyBuilder
as suggested by @henrik242:
configure<CargoPluginExtension> {
containerId = "tomcat8x"
port = 7070
withGroovyBuilder {
"deployable" {
"setContext"("example")
}
"remote" {
"setHostname"("myhost")
"setUsername"("someuser")
"setPassword"("xxx")
}
}
}
how to convert cargo gradle config syntax to build.gradle.kts file?