I just tried to send a maven based project to an other computer and HORROR, red markers everywhere!!
However mvn clean install is building just fine.
Quickly I noticed that Lombok is not generating getter and setter for my classes, however the @Getter and @Setter are being correctly recognised by Eclipse.
Both computers uses the same Maven version (3.0.4) but different JDKs (1.6_23 and 1.6_33). They both use Eclipse Indigo 32 bit.
When starting with a fresh eclipse installation you in fact need to "install" Lombok before being able to use it.
Go where you Lombok jar is, run it (Example:
java -jar lombok-1.16.10.jar). A window should appear, browse to youreclipse.exelocation.Click on install.
Launch Eclipse, update project configuration on all project and voila.
If you use STS. You must have Lombok installed in your Eclipse by running lombok-xyz.jar
Please Try the Following the Steps:
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.
Note that if you're using IntelliJ, you'll want to install the Lombok plugin (available from IDE settings) and also enable annotation processing.
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.
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.
When using lombok on a fresh installation of Eclipse or STS, you have to:
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.
Restart your IDE (Eclipse or STS)
Give some time for eclipse to generate the class files for lombok (Might take a up to 4 mins in some cases)
I am using Red hat Jboss developer studio. I solved this issue by:
The project has
lombokdependency. First look into your.m2repository and find thelombokjarDouble click on the jar, you will see installer there specify the path for IDE like
C:\Users\xxx\devstudio\studio\devstudio.exeRestart the IDE and update the maven project the error will go
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
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.
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.)
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.
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 complet exemple in this link https://howtodoinjava.com/automation/lombok-eclipse-installation-examples/
Remove @Getter from private static field.
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
来源:https://stackoverflow.com/questions/11803948/lombok-is-not-generating-getter-and-setter
