Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradle syntax how to convert to gradle kotlin script #195

Open
lenvonsam opened this issue Sep 14, 2019 · 5 comments
Open

gradle syntax how to convert to gradle kotlin script #195

lenvonsam opened this issue Sep 14, 2019 · 5 comments

Comments

@lenvonsam
Copy link

lenvonsam commented Sep 14, 2019

how to convert cargo gradle config syntax to build.gradle.kts file?

@henrik242
Copy link

@bmuschko Would you be able to provide kotlin-dsl samples as well?

@bmuschko
Copy link
Owner

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.

@jutoft
Copy link

jutoft commented Jan 14, 2020

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.

@henrik242
Copy link

Try using the Kotlin DSL Groovy Builder, that worked for us.

@jruuttun
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants