Home Tutorials Training Consulting Products Books Company Donate Contact us

NOW Hiring

Quick links


Lombok. This article describes how to use Lombok for the creation of data/model objects.

1. Introduction to lombok

The offical lombok website can be found here: https://projectlombok.org/

Lombok is used to reduce boilerplate code for model/data objects, e.g., it can generate getters and setters for those object automatically by using Lombok annotations. The easiest way is to use the @Data annotation.

package de.vogella.jpa.simple.model;

import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

public class Todo {
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String summary;
    private String description;

By simply adding the @data annotation you get all this for free:

data todo

2. Using lombok in Java projects

2.1. Using Gradle

In order to add lombok to the classpath of a Java Project with Gradle the following dependency has to be added:

dependencies {

2.2. Using Maven

In order to add lombok to the classpath of a Java Project with Apache Maven the following dependency has to be added:


2.3. Doing it manually

The lombok library can also be downloaded directly from here: https://projectlombok.org/download.html and be added to the classpath.

lombok manual classpath

3. Enable lombok for Eclipse or Spring Tool Suite

You can download the latest lombok version from https://projectlombok.org/download.html or by using Gradle, Maven or other tools.

The lombok.jar can be copied into the root Eclipse or Spring Tool Suite folder and run like this:

java -jar lombok-1.16.12.jar

This will open a small UI, where the location of the Eclipse installation can be specified. Usually the Eclipse installation will be found automatically and lombok can be installed or updated.

lombok installer

Just press the Install / Update button and restart the IDE.

Sometimes this error message is shown:

cannot find IDE error

Then the location of the installation has to be specified. Therefore press the Specify location…​ button and select the eclipse.ini or STS.ini file.

select eclipse installation

4. About this website

5. Lombok online resources

5.1. vogella GmbH training and consulting support


The vogella company provides comprehensive training and education services from experts in the areas of Eclipse RCP, Android, Git, Java, Gradle and Spring. We offer both public and inhouse training. Whichever course you decide to take, you are guaranteed to experience what many before you refer to as “The best IT class I have ever attended”.

The vogella company offers expert consulting services, development support and coaching. Our customers range from Fortune 100 corporations to individual developers.

Copyright © 2012-2017 vogella GmbH. Free use of the software examples is granted under the terms of the EPL License. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.

See Licence.