how to configure lombok in eclipse luna

后端 未结 13 879
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 09:45

I configure lombok in eclipse Luna with Maven. Annotation is added properly, but no getter and setter are generated.

eclipse.ini

`-vm E:\\Program Fil         


        
相关标签:
13条回答
  • 2020-11-30 09:58

    Just remove the 'F:\' from -javaagent

    -vm E:\Program Files\Java\jdk1.7.0_60\bin

    -vmargs

    -Dosgi.requiredJavaVersion=1.7

    -javaagent:\Tools\Java Lib\Lombok\lombok.jar

    -Xbootclasspath/a:F:\Tools\Java Lib\Lombok\lombok.jar

    -Xms40m

    -Xmx512m

    0 讨论(0)
  • 2020-11-30 10:00

    For Integrattion with ECLIPSE LUNA in Windows 7 please foollow the below steps:

    • Download the jar -> lombok-1.14.6.jar.
    • Using command prompt go to java installed directory and type

      java -jar ${your_jar_path}\lombok-1.14.6.jar.
      

      Here ${your_jar_path} is your lombok-1.14.6.jar jar store directory.

    • After this it will prompt for Eclipse already installed in your system and you need to select where you want to integrate.
    • After this you need to open eclipse.ini file and make entry below

      -vmargs
      

      as

      -Xbootclasspath/a:lombok.jar
      -javaagent:lombok.jar
      
    • Start your eclipse now and create a Maven project and make entry in pom.xml as mentioned below:

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

    After this your are ready to write your code and check it. Without @DATA annotation it looks like: enter image description here With @DATA annotation it looks like: enter image description here

    An example i ran the command

    C:\Program Files\Java\jdk1.7.0_75>java -jar C:\Users\Shareef-VM.m2\repository\o rg\projectlombok\lombok\1.14.8\lombok-1.14.8.jar

    0 讨论(0)
  • 2020-11-30 10:02

    Disclosure: I am one of the lombok developers. I might be biased :-)

    I strongly suggest installing Lombok via executing the lombok jar: java -jar lombok.jar The spaces in the path might be a problem.

    Also, you'll need to use lombok version 1.14.8 (or higher) to have Luna support.

    Please check in the About Eclipse screen if lombok is installed correctly.

    See also Cannot make Project Lombok work on Eclipse (Helios)

    0 讨论(0)
  • 2020-11-30 10:09

    Step 1: Create a maven project in Eclipse and add the below dependency in the pom.xml

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

    Step 2: Run As --> Configuraitons --> Goto Arguments --> give arguments like below maven -clean install

    Step 3: Run As --> maven clean

    Once you do the maven clean you see Build Success and lombok jar file in the maven Dependencies

    Step 4: Goto the jar location as shown in the below screen shot.

    Step 5: Give command as shown like below after reaching in the .m2 folder

    Step 6: Locate where is your eclipse folder once you this window.Once you see Install Successfull message click on Quit Installer option at the bottom.

    Step 7 : We have finished installing the lombok.jar successfully .Now restart your Eclipse IDE and Start below Sample Code to check whether the data is coming or not in the getters and setters.

    Step 8: Open Eclipse and create simple Java Maven project and see in the Outline section you can see getters and setters are created you can use either @Data or @Getter @Setter On top of class or you can give on top of variable

    @Getter @Setter
    privateString riverName;
    

    {OR}

    @Getter
    @Setter
    Class River{
    String riverName;
    }
    

    [OR]

    @Data
    class River 
    {
    Private String riverName;
    
    }
    

    You can see the project structure and Outline Structure how it got created in simple steps.

    0 讨论(0)
  • 2020-11-30 10:10

    If you are in Windows, please select "run as administrator" for the command prompt for executing the java app (ie: for executing java -jar ${your_jar_path}\lombok-1.14.6.jar).

    0 讨论(0)
  • 2020-11-30 10:12

    After two weeks of searching and trying, the following instructions works in

    Eclipse Java EE IDE for Web Developers.

    Version: Oxygen.3a Release (4.7.3a) Build id: 20180405-1200

    1. Copy Lombok.jar to installation directory my case (/opt/eclipse-spring/)
    2. Modify eclipse.ini openFile --launcher.appendVmargs

    as follows:

    openFile
    --launcher.appendVmargs
    -vmargs
    -javaagent:/opt/eclipse-spring/lombok.jar
    -Dosgi.requiredJavaVersion=1.8
    

    ......

    In build.gradle dependencies, add lombok.jar from file as follows

    compileOnly files('/opt/eclipse-spring/lombok.jar')

    And yippee, I have a great day coding with lombok.

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