i tried every method i could think of to get to a ...
# gradle
r
i tried every method i could think of to get to a closure created under dependencies.ext by a gradle plugin written in groovy that I have to use for this application
e
this should be possible
(dependencies as ExtensionAware).extra.properties
will get you the extra properties registered on
dependencies
then this sample should guide you to using the Groovy Closure from Kotlin: https://github.com/gradle/kotlin-dsl/tree/master/samples/groovy-interop
Actually the sample does exactly that, invoking a Groovy Closure that was registered as an extra property. In the sample, the extra property is set on the
Project
but it shouldn’t matter.
Copy code
dependencies {
    val theClosure = (dependencies as ExtensionAware).extra["someName"] as groovy.lang.Closure<Any?>
    theClosure("the", "arguments")
}