Partner – Moderne – NPI EA (cat=Spring Boot)
announcement - icon

Refactor Java code safely — and automatically — with OpenRewrite.

Refactoring big codebases by hand is slow, risky, and easy to put off. That’s where OpenRewrite comes in. The open-source framework for large-scale, automated code transformations helps teams modernize safely and consistently.

Each month, the creators and maintainers of OpenRewrite at Moderne run live, hands-on training sessions — one for newcomers and one for experienced users. You’ll see how recipes work, how to apply them across projects, and how to modernize code with confidence.

Join the next session, bring your questions, and learn how to automate the kind of work that usually eats your sprint time.

Course – Black Friday 2026 – NPI EA – main – before_post_content
announcement - icon

Yes, we're now running our Black Friday Sale. All Courses are 33% off until 1st December, 2026 at 17:00 Romania time:

>> EXPLORE ACCESS NOW

Course – Black Friday 2026 – NPI – main – before_post_content
announcement - icon

Yes, we're now running our Black Friday Sale. All Courses are 33% off until 1st December, 2026 at 17:00 Romania time:

>> EXPLORE ACCESS NOW

1. Overview

Lombok is a library that facilitates many tedious tasks and reduces Java source code verbosity.

Of course, we usually want to be able to use the library in an IDE, which requires additional setup.

In this tutorial, we’ll talk about configuring Lombok in two of the most popular Java IDEs — IntelliJ IDEA and Eclipse.

Further reading:

Using Lombok's @Builder Annotation

Learn how the @Builder annotation in Project Lombok can help you reduce boilerplate code when implementing the builder pattern to create instances of your Java classes.

Introduction to Project Lombok

A comprehensive and very practical introduction to many useful usecases of Project Lombok on standard Java code.

2. Lombok in IntelliJ IDEA

As of IntelliJ version 2020.3, we don’t need to configure the IDE to use Lombok anymore. The IDE comes bundled with the plugin. Also, the annotation processing will be enabled automatically.

In earlier versions of IntelliJ, we need to perform the below steps to use Lombok. Also, if we use the latest version and the IDE doesn’t recognize the Lombok annotation, we need to verify that the below configuration was not disabled manually.

2.1. Enabling Annotation Processing

Lombok uses annotation processing through APT. So, when the compiler calls it, the library generates new source files based on annotations in the originals.

Annotation processing isn’t enabled by default, though.

Therefore, the first thing to do is to enable annotation processing in our project.

We need to go to the Preferences | Build, Execution, Deployment | Compiler | Annotation Processors and make sure of the following:

  • Enable annotation processing box is checked
  • Obtain processors from project classpath option is selected
annotation processor 1

2.2. Installing the IDE Plugin

While Lombok generates code only during compilation, the IDE highlights errors in raw source code:

lobom2

From IntelliJ IDEA 2020.3 onwards, the Lombok plugin is bundled by default:

lombok plugin

If the Lombok plugin is installed and enabled, make sure the Annotation processing is enabled.

3. Lombok in Eclipse

If we’re using Eclipse IDE, we need to get the Lombok jar first. The latest version is located on Maven Central.

For our example, we’re using lombok-1.18.4.jar.

Next, we can run the jar via java -jar command, and an installer UI will open. This tries to automatically detect all available Eclipse installations, but it’s also possible to specify the location manually.

Once we’ve selected the installations, we press the Install/Update button:

lombok6

If the installation is successful, we can exit the installer.

After installing the plugin, we need to restart the IDE and ensure that Lombok is correctly configured. We can check this in the About dialog:

lombok7

4. Adding Lombok to the Compile Classpath

The last remaining part is to ensure that Lombok binaries are on the compiler classpath. Using Maven, we can add the dependency to the pom.xml:

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

The most recent version is located on Maven Central.

Everything should be fine now. The source code should be shown without errors in the IDE, correctly compiled and executed:

public class UserIntegrationTest {

    @Test
    public void givenAnnotatedUser_thenHasGettersAndSetters() {
        User user = new User();
        user.setFirstName("Test");
        assertEquals(user.getFirstName(), "Test");
    }

    @Getter @Setter
    class User {
        private String firstName;
    }
}

5. Conclusion

Lombok does a great job of reducing Java verbosity and covering boilerplate stuff under the hood. In this article, we checked how to configure the tool for the two most popular Java IDEs.

The code backing this article is available on GitHub. Once you're logged in as a Baeldung Pro Member, start learning and coding on the project.
Partner – Moderne – NPI EA (tag=Refactoring)
announcement - icon

Modern Java teams move fast — but codebases don’t always keep up. Frameworks change, dependencies drift, and tech debt builds until it starts to drag on delivery. OpenRewrite was built to fix that: an open-source refactoring engine that automates repetitive code changes while keeping developer intent intact.

The monthly training series, led by the creators and maintainers of OpenRewrite at Moderne, walks through real-world migrations and modernization patterns. Whether you’re new to recipes or ready to write your own, you’ll learn practical ways to refactor safely and at scale.

If you’ve ever wished refactoring felt as natural — and as fast — as writing code, this is a good place to start.

Course – Black Friday 2026 – NPI EA – main – after_post_content

announcement - icon

Yes, we're now running our Black Friday Sale. All Courses are 33% off until 1st December, 2026 at 17:00 Romania time:

>> EXPLORE ACCESS NOW

Course – Black Friday 2026 – NPI – main – after_post_content

announcement - icon

Yes, we're now running our Black Friday Sale. All Courses are 33% off until 1st December, 2026 at 17:00 Romania time:

>> EXPLORE ACCESS NOW