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
I have met with the exact same problem.
And it turns out that the configuration file generated by gradle asks for java1.7.
While my system has java1.8 installed.
After modifying the compiler compliance level to 1.8. All things are working as expected.
While installing lombok in ubuntu machine with java -jar lombok.jar
you may find following error:
java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper
You can overcome this by simply doing following steps:
Step 1: This can be done by editing the accessibility.properties file of JDK:
sudo gedit /etc/java-8-openjdk/accessibility.properties
Step 2: Comment (#) the following line:
assistive_technologies=org.GNOME.Accessibility.AtkWrapper
Step 1: Goto https://projectlombok.org/download and click on 1.18.2
Step 2: Place your jar file in java installation path in my case it is C:\Program Files\Java\jdk-10.0.1\lib
step 3: Open your Eclipse IDE folder where you have in your PC.
Step 4: Add the place where I added then open your IDE it will open without any errors.
-startup
plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.700.v20180518-1200
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-javaagent:C:\Program Files\Java\jdk-10.0.1\lib\lombok.jar
-Xbootclasspath/a:C:\Program Files\Java\jdk-10.0.1\lib\lombok.jar
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx1024m
--add-modules=ALL-SYSTEM
if you're on windows, make sure you 'unblock' the lombok.jar before you install it. if you don't do this, it will install but it wont work.
For Gradle
users, if you are using Eclipse or one of its offshoots(I am using STS 4.5.1.RELEASE
), all that you need to do is:
In build.gradle, you ONLY need these 2 "extra" instructions:
dependencies {
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
}
Right-click on your project > Gradle > Refresh Gradle Project. The lombok-"version".jar
will appear inside your project's Project and External Dependencies
Right-click on that lombok-"version".jar
> Run As > Java Application (similar to double-clicking on the actual jar or running java -jar lombok-"version".jar
on the command line.)
A GUI will appear, follow the instructions and one of the thing it does is to copy lombok.jar
to your IDE's root.
The only other thing you will need to do(outside of the GUI) is to add that lombok.jar
to your project build path
That's it!
Here is the complete steps to be followed, you wont see any issues.
1. Download Lombok Jar File - Its better to have a Maven/Gradle dependency in your application. The maven depency can be found here: https://mvnrepository.com/artifact/org.projectlombok/lombok
2. Start Lombok Installation -
Once the jar downloaded in Local repository, goto the jar location from command prompt and run the following command java -jar lombok-1.16.18.jar
and we should be greeted by Lombok installation window provided by lombok like this.
3. Give Lombok Install Path - Now click on the “Specify Location”
button and locate the eclipse.exe/STS.exe
path under eclipse installation folder like this.
4. Finish Lombok Installation - Now we need to finally install this by clicking the “Install/Update” button and we should finished installing lombok in eclipse and we are ready to use its hidden power. Final screen will look like,
5. Please make sure to add below entry into the STS.ini
file, if its not already there.
-vmargs -javaagent:lombok.jar
Note: After doing all this if this doesn't worked then make sure to change the workspace and build the code again. It will work.