Ji Sungbin
09/01/2023, 4:50 AMinterface TestI { val value: String }
abstract class TestExtension @Inject constructor(objects: ObjectFactory) {
val testI =
objects.property(TestI::class.java).convention(object : TestI {
override val value: String = "AA"
})
}
class MyGradlePlugin : Plugin<Project> {
override fun apply(project: Project) {
val mgp = project.extensions.create<TestExtension>("mgp")
println("testI: ${mgp.testI.get().value}")
}
}
I’m using this like below, but the testI
log value always printed as “AA”. How do I get “BB”?
mgp {
testI.set(object : TestI {
override val value: String = "BB"
})
}
Vampire
09/01/2023, 7:19 AMJi Sungbin
09/03/2023, 7:05 AM