This message was deleted.
# community-support
s
This message was deleted.
j
Does it need to be a property ?
v
The docs are right, the advice to make it a
var
is non-sense. You probably are simply on an outdated Gradle version.
j
gradle version 8.5 😕
v
If that's not the case, please share an MCVE.
j
OK, thanks
I will try
a
did you copy the sample to a
build.gradle.kts
file, or another
.kt
file?
j
I copy it to a kt file in my plugin project...
I tried to create a sample project and if I add it there, be it in a regular build.gradle.kts or in the code of a plugin... it just works... but in my plugin project it won't
v
The assignment syntax for lazy Gradle types needs a properly applied and configured Kotlin compiler plugin. If you would apply the
kotlin-dsl
plugin I guess it would also set this compiler plugin up properly like it does with the
sam-with-receiver
plugin. Alternatively you can use
.set()
instead of
=
thank you 1
j
I have this in my plugin module
Copy code
plugins {
    `kotlin-dsl`
    `maven-publish`
}
and it still does not work... for now I am going with the
.set
. Thanks
e
a normal
.kt
file also doesn't get Gradle's default imports. you need
Copy code
import org.gradle.kotlin.dsl.assign
for the assignment operator too
☝️ 1
v
Yep, can confirm, I just tried it out. With
kotlin-dsl
(or the compiler plugin applied somehow else) and the import it works in a normal kt file