Configure Lombok

In this article, we will learn how to install Lombok in STS or eclipse and configure it so that you can use it in development.

To use Lombok in development, you need to
1. Install lombok in your IDE.
This article will outline the steps to install it in STS and eclipse.
2. Add lombok to project classpath
Lombok jar is required in the classpath at compile time. This article will explain how to do that.

1. Installing Lombok in STS
Following are the steps to install or add lombok to STS

Method 1: Download and install
A. Download lombok.jar from official download link.

B. Once downloaded, open command prompt onĀ  window or terminal on MacOS and execute command

java -jar lombok.jar

You will see below window

Install lombok in STS/eclipse
Once you click Install button, it will add lombok to STS or eclipse.

Restart STS after installation is completed.

To confirm that it is successfully added, go to STS Help menu and click About link. You will see lombok version and project link at the bottom.
Check lombok in STS/eclipse

Method 2: From STS/eclipse
Another way to install lombok in STS or eclipse is by going to its Help menu -> Install New Software.

Enter the URL as given in the image below and follow installation instructions.
install lombok in STS from menu
Once the installation is complete, check if lombok is installed successfully.

Above steps are same for installation in STS, eclipse and Myeclipse.

For installing lombok in other IDEs such as IntelliJ, Netbeans or VS code, use the instructions given here.

2. Add lombok to project
Lombok is required at compile time in the project. That is, lombok.jar should be present on the classpath of the project.
So, you need to add following dependencies as per your build tool.

Gradle

dependencies {
  compileOnly 'org.projectlombok:lombok:1.18.30'
  annotationProcessor 'org.projectlombok:lombok:1.18.30'
}

Maven

<dependency>
  <groupId>org.projectlombok</groupId>
  <artifactId>lombok</artifactId>
  <version>1.18.30</version>
  <scope>provided</scope>
</dependency>

After adding these dependencies, re-build your project.

You are now ready to apply lombok in your project.