Project Lombok
  • Features
    • Stable
    • Experimental
  • Community
    • Discuss / Help
    • Issues
    • Documentation for contributors
    • Contact the team behind Project Lombok
  • Order / Donate
  • How to use Install
    • Compilers
    • Javac
    • ECJ
    • Build tools
    • maven
    • gradle
    • ant
    • kobalt
    • IDEs
    • Eclipse
    • IntelliJ IDEA
    • Netbeans
    • MyEclipse
    • Spring Tool Suite
    • JBoss Developer Studio
    • Visual Studio Code
    • Platforms
    • Android
    • GWT
  • Download

Gradle

To set up lombok with any build tool, you have to specify that the lombok dependency is required to compile your source code, but does not need to be present when running/testing/jarring/otherwise deploying your code. Generally this is called a 'provided' dependency. This page explains how to integrate lombok with the Gradle build tool.

Lombok is available in maven central, so telling Gradle to download lombok is easy.

The Lombok Gradle Plugin

There is a plugin for gradle that we recommend you use; it makes deployment a breeze, and makes it easy to do additional tasks, such as delomboking. The plugin is open source. Read more about the gradle-lombok plugin.

Gradle without a plugin

If you don't want to use the plugin, gradle has the built-in compileOnly scope, which can be used to tell gradle to add lombok only during compilation. Your build.gradle or build.gradle.kts will look like:

repositories {
	mavenCentral()
}

dependencies {
	compileOnly("org.projectlombok:lombok:1.18.38")
	annotationProcessor("org.projectlombok:lombok:1.18.38")
	
	testCompileOnly("org.projectlombok:lombok:1.18.38")
	testAnnotationProcessor("org.projectlombok:lombok:1.18.38")
}

Remember that you still have to download lombok.jar (or find it in gradle's caches) and run it as a jarfile, if you wish to program in eclipse. The plugin makes that part easier.

Android development

Complete instructions for integrating lombok with your android development is available on our Using lombok for android development page.

credits | Copyright © 2009-2025 The Project Lombok Authors, licensed under the MIT license.