Introduction to Project Lombok

Project Lombok is a Java library that will be plugged into your code editor which automatically generates Java boilerplate byte code for you based on a couple of annotations.

Some of the popular annotations include @Getter, @Setter, @EqualsAndHashCode, @NoArgsConstructor, @Builder, etc.

Incase you're using maven as your dependency management tool, Project Lombok can easily be integrated in your project by adding code below in your pom.xml file.

<!-- -->

It's also possible to integrate this library in your favorite IDE or text editor. i.e

For purpose of demonstration. Let's integrate this library in Eclipse.

# Integrating Project Lombok in Eclipse

NOTE: The instructions below assume you already have eclipse ide for java ee installed on your machine.

As of writing, Eclipse IDE 2019‑06 is the latest version.

  • Locate where your maven local repository is located to find project lombok's jar file.
  • TIP: You could alternatively get the jar file from Lombok's download page.

    You could also use this same jar file to uninstall lombok from your IDE.

    • For Windows C:\Users\your-username\.m2\ repository\org\projectlombok\lombok\lombok-version-no
    • NOTE: Replace "your-username" i.e John and "lombok-version-no" i.e 1.18.8 with their respective names.

      TIP: This is the default path but it may be different depending on a change in installation path settings.

    • For Unix systems ~/.m2/repository/org/projectlombok/lombok/lombok-version-no/
  • For windows, Double-click the jar file i.e lombok-1.18.8.jar to open it up.
    • In the window that opens up, a list of installed IDEs show up.
    • In case a list doesn't show up, Close Can't find IDE window >> Click Specify location... button and navigate to your custom IDE installation directory location.

  • After selecting your IDE in the list, Click Install/Update button.
  • After installing, Quit the Installer window. And restart your IDE.
  • To verify that lombok is enabled, Click >> Help tab >> About >> You should be able to see the lombok version right at the bottom of the text displayed in the "About Eclipse Window". i.e "Lombok 1.16.13 'Edgy Guinea Pig' 2016-12-13 is installed"
  • That's it for today. Don't hesitate to leave a comment. Your feedback is greatly appreciated.
About The Author   

Steven Mwesigwa

Software Engineer at Vogue Book Consultancy Services Ltd

Picture Of Steven Mwesigwa

Steve is currently a software developer at Vogue Book Consultancy Services Ltd and a technology author. He holds a Dip. in civil engineering from Kyambogo University. He founded and maintains a website that receives more than 1.5 thousand visits per month. Steve can be reached on Twitter at @steven7mwwesigwa