If you are using java for your development projects, you probably will know how handy IntelliJ IDEA IDE is. Devs tired of writing lengthy getters and setters use Lombok library.

IntelliJ IDEA is a much-loved IDE by Spring framework developers.

In this post I am going to share how to use Lombok plugin in IntelliJ IDEA.

First to understand what Lombok is, here is an extract from the official website of the Lombok project:

Project Lombok is a java library that automatically plugs into your editor and builds tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a fully-featured builder, Automate your logging variables, and much more.

Project Lombok

Lombok is used basically to automate getters and setters of variables required for your project. It not only reduces the code length but also eliminates the tendency to miss any of them.

If you check out the official website of the Lombok project, you will see that it IntelliJ IDEA supports Lombok library.

How to use Lombok in IntelliJ IDEA Plugin

Here’s how to add the plugin in IntelliJ IDEA.

Like adding any other libraries in java projects, depending on what build tool you use, you have to add it to your project.

For example, if you are using a maven build tool, add the following code in your pom.xml file (in your dependencies list).

<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency>
Code language: HTML, XML (xml)

Based on your requirements, you can explore how to add it to your projects from the link project Lombok official website.

After adding Lombok dependency to your project, this is what you should do.

  1. Go to File > Settings > Plugins
  2. Click on Marketplace
  3. Search for Lombok Plugin
  4. Click on Install plugin
  5. Restart IntelliJ IDEA
Adding Lombok plugin in IntelliJ IDEA IDE
Adding Lombok plugin in IntelliJ IDEA IDE

After restarting your IDE, you will able to use Lombok annotations.

Leave a Reply

Scroll to Top