Reducing Java Boilerplate code with Lombok (With Eclipse Installation)

I was looking for  ways to  reduce my class LOC. most of the time, setters and getters lengthens my code length and gives me a hard time to look at the important parts of it. so I decided to on a journey to reduce my boilerplate code.

During this quest, I found . Project Lombok.

In a nutshell project lombok replaces your common  java boilerplate code with a simple annotations.

One of the things I like about Project Lombok is their @Setter and @Getter annotations.

it shortens your class LOC, say good bye to those (getBar(),setBar(String bar))

Installation In Eclipse. 

Adding the jar the alone is not enough for lombok to work.  what we need to do is.

is to ‘Install’ Lombok.

java -jar lombok.jar

We run this command in our CMD, make sure that when you are going to run/execute lombok.jar, make you are in the directory on where it is located. upon running that command a screen will show up.


Click ‘Install/update’.

Right after that check your IDE’s .ini file or configuration file. the following parameters should be  added (below -vmargs for Eclipse)


Once it is done. we can now already add lombok.jar in our projects.

A Simple Example Using Lombok.

here’s  a simple example of Lombok (taken from my personal project)


As you can see on our Outline, the Annotations @Getter and @Setter created the setters and getters for our class instance variables.

Other Concerns And references:


I just found out that they have support for IntelliJ Idea. Checkout the plugin here

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s