Lombok is not generating getter and setter

前端 未结 20 1734
走了就别回头了
走了就别回头了 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:21

    Intellij User, make sure you have 3 things,

    1. Lombok dependency
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.18.8</version>
                <scope>provided</scope>
            </dependency>
    
    1. IntelliJ plugin for Lombok

    2. Lombok annotation, like @Getter @Setter (make sure it is coming from lombok and not from somewhere else)

    and it should work.

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

    Download Lombok Jar, let’s maven do the download on our behalf :

     <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.18</version>
        </dependency>
    

    Now... mvn clean install command on the newly created project to get this jar downloaded in local repository. Goto the jar location, execute the command prompt, run the command : java -jar lombok-1.16.18.jar

    click on the “Specify Location” button and locate the eclipse.exe path LIKE :

    finally install this by clicking the “Install/Update”

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

    just adding the dependency of Lombok is not enough. You'll have to install the plugin of Lombok too.

    You can get your Lombok jar file in by navigating through (Only if you have added the dependency in any of the POM.)

    m2\repository\org\projectlombok\lombok\1.18.12\lombok-1.18.12

    Also, if Lombok could not find the IDE, manually specify the .exe of your IDE and click install.

    Restart your IDE.

    That's it.

    If you face any problem,

    Below is a beautiful and short video about how to install the plugin of Lombok.

    Just to save your time, you can start from 1:40.

    https://www.youtube.com/watch?v=5K6NNX-GGDI

    If it still doesn't work,

    Verify that lombok.jar is there in your sts.ini file (sts config file, present in sts folder.)

    -javaagent:lombok.jar

    Do an Alt+F5. This will update your maven.

    Close your IDE and again start it.

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

    What I had to do was to install lombok in the eclipse installation directory.

    Download the lombok.jar from here and then install it using the following command:

    java -jar lombok.jar
    

    After that make sure that the lombok.jar is added in your build path. But make sure you don't add it twice by adding once through maven or gradle and once again in eclipse path.

    After that clean and build the project again and see all the errors go away.

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

    For Sprint STS - Place the lombok.jar file in the eclipse/sts exe folder and add the following entry to the STS.ini.

    -javaagent:lombok.jar
    
    0 讨论(0)
  • 2020-11-29 19:26

    If you are using maven and Eclipse, must be installed manually.

    1. Verify pom

     <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.18.10</version>
                <type>jar</type>
            </dependency>

    1. go to Maven Dependencies

    1. Right click in the library and Run as Java aplication

    1. Especify location IDE, install and close IDE (Eclipse).
    0 讨论(0)
提交回复
热议问题