<#import "_setup.html" as s> <@s.scaffold title="Ant+ivy"> <@s.introduction>

This page explains how to compile your code when you use the Apache Ant build tool. We suggest you use ivy, the ant add-on that lets you fetch dependencies from the internet automatically.

Lombok needs to be available when you compile your code to do its work. For non-modular builds on JDK22 and below, it is enough to put lombok on the classpath in your <javac> task. On JDK23 and above, you also need to enable annotation processing explicitly.

<@s.section title="Just ant">

Assuming that you've put lombok.jar in a lib dir, your javac task would have to look like:

<javac srcdir="src" destdir="build" source="1.8">
	<classpath location="lib/lombok.jar" />
</javac>

When compiling with JDK23 or newer, you also need to enable annotation processing explicitly, for example by adding lombok to the processor path:

<javac srcdir="src" destdir="build" source="1.8">
	<classpath location="lib/lombok.jar" />
	<compilerarg value="-processorpath" />
	<compilerarg path="lib/lombok.jar" />
</javac>

<@s.section title="Ant with Ivy">

Lombok is available in Maven Central, so you can tell ivy to fetch lombok like so (assuming you have a configuration named build:

<dependencies>
	<dependency org="org.projectlombok" name="lombok" rev="${version}" conf="build->master" />
</dependencies>

When compiling with JDK23 or newer, make sure the ivy-resolved lombok jar is also passed to javac as an annotation processor path, or enable annotation processing explicitly with -proc:full.