Search code examples
gradle-kotlin-dsl

Gradle Kotlin DSL: access objects defined in settings.gradle.kts


I have objects I define in settings.gradle.kts. How can I get them from build.gradle.kts?

With the groovy DSL, I could put these objects in gradle.ext, but the gradle object doesn't seem to support extra in the Kotlin DSL (using Gradle 5.2).


Solution

  • You could access extension objects using following code:

    (gradle as ExtensionAware).extra["myObject"]