Proper way to get properties with Kotlin-script config for Gradle

Viewed 5728

I have a property in gradle.properties:

answer = 42

Which is used in build.gradle:

println "answer is ${answer}"

Now I want to replace Groovy with Kotlin-script for Gradle configuring. How to access properties in a proper way? What I'm doing now in build.gradle.kts is:

fun property(name: String) = properties[name] as String

println("answer is " + property("answer"))

Which does not seem to be very convenient. Thanks!

1 Answers
Related