Lombok is not generating getter and setter

前端 未结 20 1735
走了就别回头了
走了就别回头了 2020-11-29 19:10

I just tried to send a Maven-based project to another computer and HORROR, red markers everywhere!!

However, mvn clean install is building just fine.

相关标签:
20条回答
  • 2020-11-29 19:35

    These are command line instructions where the above Graphical version is not available or you can not open the Lombok jar file by double clicks, like in Ubuntu.

    At the time of writing using Lombok is not straightforward as just adding a dependency in your POM xml file and adding the annotation. These are the next steps:

    1) Locate where your Lombok jar file is downloaded by maven; Usually it is in .m2 folder inside your home directory. Then execute the following command.

    java -jar lombok-1.16.18.jar install <path of where your IDE is installed>
    

    example usage:

    java -jar lombok-x.xx.xx.jar install ~/Downloads/spring-tool-suite-3.9.1.RELEASE-e4.7.1a-linux-gtk-x86_64/sts-bundle/sts-3.9.1.RELEASE/
    

    the above command basically makes a configuration update in your IDE .ini or configuration file something like below:

    -javaagent:/home/neshant/Downloads/spring-tool-suite-3.9.1.RELEASE-e4.7.1a-linux-gtk-x86_64/sts-bundle/sts-3.9.1.RELEASE/lombok.jar
    

    this ensures that the @Data or @Getter or @Setter annotations are understood by the IDE. It is weird that it had to be so complex.

    0 讨论(0)
  • 2020-11-29 19:35

    I also encountered this issue, for my case, it's because I upgrade my IntelliJ IDEA without upgrading the Lombok plugin. So they are incompatible.

    0 讨论(0)
提交回复
热议问题