Lombok problems with Eclipse Oxygen

后端 未结 20 829
南方客
南方客 2020-12-02 16:40

I upgraded recently to the new Eclipse version (Oxygen). I downloaded the lombok.jar from the website and installed it. This is how the eclipse.ini looks like a

相关标签:
20条回答
  • 2020-12-02 17:20

    Also had problems with lombok in eclipse oxygen.

    My solution: returned from java version 8u144 to 8u141.

    And I refer to lombok by adding this to my eclipse.ini:

    -Xbootclasspath/c:/DEV/Tools/lombok-1.16.18/lombok.jar

    -javaagent:/DEV/Tools/lombok-1.16.18/lombok.jar

    0 讨论(0)
  • 2020-12-02 17:23

    Solution:

    1. Install lombok 1.16.18 as instructed by lombok website. It's better Eclipse is close during installation.

    2. Make sure Eclipse can start up properly. On the shortcut, change the properties, and fill in the "Start in" path and it will work as noted by Thomas and Fabiano.

    3. Once Eclipse opens, update Maven on the project to solve compilation errors.

    4. Now Lombok latest release works with Eclipse latest release.

    For reference:

    My Eclipse: Oxygen

    Version: Oxygen.2 Release (4.7.2)
    Build id: 20171218-0600 
    

    My JRE/JDK: 1.8

    java version "1.8.0_152"
    Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
    Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
    

    lombok 1.16.18

    0 讨论(0)
  • 2020-12-02 17:23

    Hello I solved that problem simply editing the lombok dependency in the pom.xml

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.16.16</version>
        <scope>provided</scope>
    </dependency>
    

    This version seems to work whit java 8.

    0 讨论(0)
  • 2020-12-02 17:27

    My env: java version "1.8.0_144"

    Eclipse: Eclipse Java EE IDE for Web Developers. Version: Oxygen Release (4.7.0) Build id: 20170620-1800

    1. Exit Eclipse(if it is open) and downloaded jar from https://projectlombok.org/download

    2. execute command: java -jar lombok.jar

    3. This command will open window as shown here https://projectlombok.org/setup/eclipse, install and quit the installer.

    4. Add jar to build path/add it to pom.xml.

      e.g. for Gradle build

     annotationProcessor("org.projectlombok:lombok")
     compileOnly("org.projectlombok:lombok")
    
    1. restart eclipse.
    2. Go to Eclipse --> About Eclipse --> check 'Lombok v1.16.18 "Dancing Elephant" is installed. https://projectlombok.org/'
    3. To enable Lombok for the project: Enable annotation processing in the respective IDE. That's it. It worked. I did not change eclipse init script.

    Note: Read the note in following image regarding -vm options If you start Eclipse with a custom -vm parameter, you'll need to add:

    -vmargs -javaagent:<path-to-lombok-jar>/lombok.jar
    

    as parameter as well

    Above steps works for Photon Release (4.8.0) - Lombok v1.18.2, eclipse: Oxygen.3a Release (4.7.3a) - Lombok v1.18.0 and eclipse: Neon.3 Release (4.6.3) - Lombok v1.18.2

    lombok success screen:

    fyi,
    For JDK - 10 and 11 support: Lombok version should be at least v1.18.4 (October 30th, 2018) or higher.

    0 讨论(0)
  • 2020-12-02 17:27

    You can install lombok through command line very easily, ~/softwares/Eclipse.app/ path to your eclipse or sts app (this is on mac) but it will also work for different OS, and it will give you the successful output.

    java -jar lombok.jar install ~/softwares/Eclipse.app/
    

    Output:

    Lombok installed to: /Users/temp/softwares/Eclipse.app
    
    0 讨论(0)
  • 2020-12-02 17:30

    Had problems with Eclipse Oxygen, Java 1.9 and Lombok (on Mac OSX - windows/linux should be similar).

    This is what I had to do:

    1. Download the latest lombok: 1.16.20
    2. Open up eclipse, and check for updates and install all of them. Ensure that eclipse is updated to the latest.
    3. Exit eclipse.
    4. java -jar lombok.jar
    5. Ensure that the location to Eclipse is correct in the installer window that pops up, I had to explicitly specify:/[some-folder-heirarchy]/Eclipse.app/Contents/Eclipse/eclipse.ini

    Thereafter check to see if the updates have made it in eclipse.ini:

    -javaagent:/[some_folder-hierarchy]/eclipse-oxygen/Eclipse.app/Contents/Eclipse/lombok.jar
    

    There is only one line that is updated. That is a change from some of the earlier versions of lombok where a bootclasspath was also specified and / or the path to lombok.jar was relative. Now it is an absolute path.

    Bring up eclipse and you would see Lombok in action.

    And do not forget to use the same Lombok version in your maven or any other dependency management tool.

    Edit 1: I also used a different version of Lombok in the maven POM from the one that is installed in eclipse and for the most part, things compiled but there were a few compile errors in eclipse. Of course, things compiled successfully on the command line with maven. So if you have project dependencies that force you to use different Lombok versions then be aware of such an eventuality. The crux is to have the same version installed in both eclipse and in your project's dependency management (maven etc.).

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