I have a Kotlin Gradle project. I added Lombok as a dependency and also registred it with kapt
compileOnly("org.projectlombok:lombok:$lombokVersion")
kapt("org.projectlombok:lombok:$lombokVersion")
I would like to use just @Slf4j
anotation for automatic log
generation. It works for Java classes but not for the Kotlin ones.
Is using Kotling and Lombok together even possible as of now ?
EDIT: Adding more details
If I annotate a Kotlin classs with @Slf4j
and use log
inside it I get
Unresolved reference: log
Evidently no annotation processing is applied.
Lombok does not run on your source code, but on the AST. Anyway, it is an annotation processor that is run at compile-time by the Java compiler. The Kotlin compiler does not use these annotation processors. See also the answer https://stackoverflow.com/a/35530223/2621917 straight from the horse’s mouth.