@nikolaymetchev use a nullable type when querying for the property:
val answer: String? by project
n
nikolaymetchev
05/11/2018, 12:04 PM
@eskatos That's what I am trying to avoid. I want to specify a default value for when the property isn't in the properties file
e
eskatos
05/11/2018, 12:13 PM
There’s no builtin construct for this on Gradle properties using Kotlin property delegates.
In a project script you can use the
Project
api as follows:
Copy code
buildscript {
dependencies {
val junitGradlePlugin = findProperty("junitGradlePlugin") as String? ?: "defaultValue"
classpath(junitGradlePlugin)
}
}
But there’s no such equivalent in settings scripts, the api is missing from the Java Gradle API.
If you feel strongly about it, feel free to open an issue on