My app uses several gradle.kts scripts. I want to set one variable which would be global for everyone.
object Versions{
val kotlin_version = "1.3.60-eap-25"
}
but it is not resolved:
classpath ("org.jetbrains.kotlin:kotlin-gradle-plugin:$Versions.kotlin_version")
Simply, it stands for 'Domain Specific Language'. IMO, in gradle context, DSL gives you a gradle specific way to form your build scripts. More precisely, it's a plugin-based build system that defines a way of setting up your build script using (mainly) building blocks defined in various plugins.
ext is shorthand for project. ext , and is used to define extra properties for the project object. (It's also possible to define extra properties for many other objects.) When reading an extra property, the ext. is omitted (e.g. println project. springVersion or println springVersion ).
Declared them in gradle.properties
file:
kotlin_version = 1.3.60-eap-25
And use it everywhere by findProperty("kotlin_version ")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With