score:218

Accepted answer

when starting with a fresh eclipse installation you, in fact, need to "install" lombok before being able to use it.

  1. go where you lombok jar is (e.g. (e.g. you can find in ~/.m2/repository/org/projectlombok/lombok/1.16.10/lombok-1.16.10.jar), run it (example: java -jar lombok-1.16.10.jar). a window should appear, browse to your eclipse.exe location.
  2. click on install.
  3. launch eclipse, update project configuration on all projects and voila.

score:-1

remove @getter from private static field.

https://github.com/rzwitserloot/lombok/issues/1493

score:-1

if you are using maven , go to maven dependencies in your project structure then run lombok jar as java project it will install it then exit and start eclipse

score:0

in mac os lombok will not be able to find eclipse location. please click on specify location and go to the eclipse installed folder you can find the eclipse.ini file select that

enter image description here

score:0

seem the answers above are ok in some cases but my case not work well somehow.

so, here what i did (that worked for me):

  1. i use spring suit 4 (springtoolsuite4.exe)
  2. projects must be maven-project
  3. i direct install lombok the version i put in pom.xml (1.18.12) not working
  4. i changed to install lombok the latest version via market place, use site: https://projectlombok.org/p2, the version is 1.18.22
  5. i see now in my springtoolsuite4.ini, this line: -javaagent:d:\xxx\eclipse\sts-4.13.0.release\plugins\org.projectlombok.agent_1.18.22/lombok.jar
  6. re-open my sts and press: alt+f5 (to open your maven projects), click ok and wait all projects to be built

and they are working.

discussion

it might be above all solutions are working but can because of the version as we always thought, we need to use the same version as in our pom.xml but it could also work with the latest one (correct me if anyone have comment).

point 2. maven projects, i did since beginning with other above solutions but still got error; somehow we have to make sure that.

one more remark: whenever you don't see a line of message in about spring tool (or about eclipse), meant that your lombok installation not correct, may try my above solution again.

hope this discussion helps others.

score:1

when using lombok on a fresh installation of eclipse or sts, you have to:

  1. install the lombok jar which you can get at https://projectlombok.org/download. run the jar (as administrator if using windows) and specify the path to your eclipse/sts installation.

  2. restart your ide (eclipse or sts)

  3. give some time for eclipse to generate the class files for lombok (might take a up to 4 mins in some cases)

score:1

for spring toolsuite 4 on mac, they renamed the ini to springtoolsuite4.ini.

you can either rename or copy it to sts.ini to be recognized by lombok. then copy it back to the original name to be read by the ide. (haven't tried if symbolic links work though.)

score:1

download lombok jar file https://projectlombok.org/downloads/lombok.jar

add maven dependency:

   <dependency>
      <groupid>org.projectlombok</groupid>
      <artifactid>lombok</artifactid>
      <version>1.16.18</version>
   </dependency>   

start lombok installation java -jar lombok-1.16.18.jar

find complete example in this link:
https://howtodoinjava.com/automation/lombok-eclipse-installation-examples/

score:1

i am using red hat jboss developer studio. i solved this issue by:

  1. the project has lombok dependency. first look into your .m2 repository and find the lombok jar

  2. double click on the jar, you will see installer there specify the path for ide like c:\users\xxx\devstudio\studio\devstudio.exe

  3. restart the ide and update the maven project the error will go

score:1

1) run the command java -jar lombok-1.16.10.jar. this needs to be run from the directory of your lombok.jar file.

2) add the location manually by selecting the eclipse.ini file(installed eclipse directory). through “specify location

note : don't add the eclipse.exe because it will make the eclipse editor corrupt.

how to add the eclipse.ini file

score:1

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.

score:1

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.

score:1

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.

score:2

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

score:2

solution for eclipse ide:

1. maven dependency in pom.xml

<dependency>
    <groupid>org.projectlombok</groupid>
    <artifactid>lombok</artifactid>
    <optional>true</optional>
</dependency>

2. go to maven dependency jar >> right click >> run as >> java application

3. select socket server and click ok

ch.qos.logback.classic.net.simplesslsocketserver
ch.qos.logback.classic.net.simplesocketserver

4. show message on console like:

wrong number of arguments. usage: java ch.qos.logback.classic.net.simplesocketserver port configfile

score:2

i spent full day, you can do it this way:

  1. add to maven lombok
  2. install eclipse
  3. download lombok
  4. copy to eclipse folder
  5. add to file eclipse.ini next text -javaagent:lombok.jar
  6. active annotation processing in select project (not the parent)
    -> properties -> java compiler -> annotation processing select enable project specific settings select all enable checkbox
  7. restart and it should work . test ubuntu 20.04 and eclipse 2021 year

score:5

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.

score:7

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.

score:7

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

enter image description here

  1. right click in the library and run as java aplication

enter image description here

  1. especify location ide, install and close ide (eclipse). enter image description here

score:7

if you use sts. you must have lombok installed in your eclipse by running lombok-abc.jar

please following the steps:

-include pom in maven . -exit/shutdown sts(must) -find lombok jar in ~.m2\repository\org\projectlombok\lombok\1.18.12 -from command enter image description here

after then enter image description here

after then select the sts.exe enter image description here

after then click to update/update

enter image description here

then quit installer

happy coding

blockquote

score:8

if you use eclipse. you must have lombok installed in your eclipse by running lombok-xyz.jar (e.g. you can find in ~/.m2/repository/org/projectlombok/lombok/1.12.6/lombok-1.12.6.jar).

as the window of installation opened, you must choose the location of your eclipse. and let it install lombok inside. you must restart your eclipse afterwards.

score:14

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

enter image description here

click on the “specify location” button and locate the eclipse.exe path like : enter image description here

finally install this by clicking the “install/update”

score:58

note that if you're using intellij, you'll want to install the lombok plugin (available from ide settings) and also enable annotation processing.

score:113

  • if you use sts. you must have lombok installed in your eclipse by running lombok-xyz.jar

  • please try the following the steps:

    1. include pom in maven .
    2. exit/shutdown sts
    3. find lombok jar in ~/.m2/repository/org/projectlombok/lombok/version.x
    4. from command prompt/shell java -jar lombok-1.x.y.jar project lombok installer

    5. start sts

thats all.

edit: i did this and was still showing errors, as mentioned in the comments. so i updated the project: right-click on project -> maven -> update project and the errors disappeared.


Related Query

More Query from same tag