java-modern-tech-practice icon indicating copy to clipboard operation
java-modern-tech-practice copied to clipboard

problem record: kotlin + lombok compile problem (under maven build)

Open oldratlee opened this issue 7 years ago • 4 comments

Problem

Kotlin doesn't see Lombok accessors in Java Files (eg: @Data).

Problem infos

  • lombok issue
    • Kotlin Support https://github.com/rzwitserloot/lombok/issues/1169
  • stackoverflow.com
    • Kotlin doesn't see Java Lombok accessors? https://stackoverflow.com/questions/35517325/kotlin-doesnt-see-java-lombok-accessors
    • Configuring kapt to process lombok annotations https://stackoverflow.com/questions/44180267/configuring-kapt-to-process-lombok-annotations
    • How to configure Lombok with maven-compiler-plugin? https://stackoverflow.com/questions/42257379/how-to-configure-lombok-with-maven-compiler-plugin

Problem status and solution

status:

has not been resolved!

Quick and dirty solution

Convert lombok-fied java file to kotlin language. aka. use kotlin instead of lombok. 😂

But this solution force the migration to kotlin, not nice! 😫

Related resources

  • set up lombok with build tool maven - projectlombok.org https://projectlombok.org/setup/maven
  • Compiling Kotlin and Java sources using Maven - kotlinlang.org https://kotlinlang.org/docs/reference/using-maven.html#compiling-kotlin-and-java-sources

oldratlee avatar Sep 09 '18 09:09 oldratlee

”Kotlin doesn't see Java Lombok accessors“,您好,请教下,像这种问题,现在有解决方案了吗?(不转java为kotlin的情况)

victory460 avatar Apr 08 '20 13:04 victory460

”Kotlin doesn't see Java Lombok accessors“,您好,请教下,像这种问题,现在有解决方案了吗?(不转java为kotlin的情况)

『不转java为kotlin』的解决方案 还没有找到 😞

oldratlee avatar Apr 09 '20 05:04 oldratlee

delombok能用,编译正常,但是热更新不好用。

参考

  • https://github.com/rzwitserloot/lombok/issues/1169#issuecomment-398228791
  • Configuring kapt to process lombok annotations https://stackoverflow.com/a/50914110/922688

fanthos avatar Sep 10 '20 05:09 fanthos

Official Kotlin support for Lombok: @victory460 @fanthos

https://kotlinlang.org/docs/lombok.html

The Lombok compiler plugin is Experimental.

oldratlee avatar Jan 17 '22 05:01 oldratlee