Solved it by using the maven-compiler-plugin configuration and specify the annotationProcessorPaths as follows:
Note I also have mapstruct, so hence the extra paths.
inside build/plugins:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>${mapstruct-processor.version}</version>
</path>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
My dependencies:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
</dependency>
My properties:
<java.version>11</java.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<mapstruct.version>1.4.2.Final</mapstruct.version>
<mapstruct-processor.version>0.2.0</mapstruct-processor.version>
<!-- Bumped version of lombok temporarily to avoid issues with IntelliJ 2020.3+ until we have upgraded to a more recent version of spring boot. -->
<lombok.version>1.18.20</lombok.version>
Note:
I override the lombok version to 1.18.20 since I'm still on an older version of spring boot which uses 1.18.12 under the hood...