Skip to content

Lombok: Add annotationProcessorPaths configuration to the maven-compiler-plugin plugin #866

@yeikel

Description

@yeikel

What problem are you trying to solve?

Ensure that the project is fully compatible with Java 25

What precondition(s) should be checked before applying this recipe?

  • lombok is in the classpath
  • The maven-compiler-plugin does not have lombok defined in the annotationProcessorPaths

Although this problem starts in Java 23+, it is still a good practice to define it explicitly

Describe the situation before applying the recipe

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

<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
		</plugin>
	</plugins>
</build>

Describe the situation after applying the recipe

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

<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<configuration>
				<annotationProcessorPaths>
					<path>
						<groupId>org.projectlombok</groupId>
						<artifactId>lombok</artifactId>
					</path>
				</annotationProcessorPaths>
			</configuration>
		</plugin>
	</plugins>
</build>

Any additional context

The official documentation lombok suggests this configuration https://projectlombok.org/setup/maven

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions