<#import "_setup.html" as s> <@s.scaffold title="Maven"> <@s.introduction>

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 Apache Maven build tool.

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

<@s.section title="Adding lombok to your pom file">

To include lombok as a 'provided' dependency, add it to your <dependencies> block like so:

<dependencies>
	<dependency>
		<groupId>org.projectlombok</groupId>
		<artifactId>lombok</artifactId>
		<version>${version}</version>
		<scope>provided</scope>
	</dependency>
</dependencies>

<@s.section title="JDK9+ with module-info.java">

The configuration of the compiler plug-in should contain the following:

<annotationProcessorPaths>
	<path>
		<groupId>org.projectlombok</groupId>
		<artifactId>lombok</artifactId>
		<version>${version}</version>
	</path>
</annotationProcessorPaths>

<@s.section title="Delomboking: The Lombok Maven Plugin">

There is a plugin for Maven that we recommend you use if you want to delombok via maven. Useful if you want to run source analysis tools on your source after lombok has been applied, or if you want to generate javadoc. The plugin is open source. Read more about the lombok maven plugin.