I am trying to migrate a gradle plugin from groovy to kotlin. I have a boolean Property
that I would like to initialize to false in my plugin extension:
open class MyPluginExtension(project: Project) {
val myBooleanProperty: Property<Boolean> = project.objects.property(Boolean::class.java)
init {
myBooleanProperty.set(false)
}
}
This fails with
java.lang.IllegalArgumentException: Cannot set the value of a property of type boolean using an instance of type java.lang.Boolean.
The exception is thrown in org.gradle.api.internal.provider.DefaultPropertyState#set(T)
Any thoughts on this?