EN
Maven + Intellij IDEA - enable lombok annotation processor from pom.xml instead of Intellij IDEA level
7 points
Quick solution:
xxxxxxxxxx
1
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
<modelVersion>4.0.0</modelVersion>
4
5
<groupId>my-project</groupId>
6
<artifactId>my-project</artifactId>
7
<version>1.0</version>
8
9
<name>my-project</name>
10
<packaging>jar</packaging>
11
12
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web/2.4.3 -->
13
<parent>
14
<groupId>org.springframework.boot</groupId>
15
<artifactId>spring-boot-starter-parent</artifactId>
16
<version>2.4.3</version>
17
<relativePath/>
18
</parent>
19
20
<properties>
21
<java.version>1.8</java.version>
22
<spring.version>${project.parent.version}</spring.version>
23
<maven.compiler.source>${java.version}</maven.compiler.source>
24
<maven.compiler.target>${java.version}</maven.compiler.target>
25
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
26
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
27
</properties>
28
29
<dependencies>
30
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
31
<dependency>
32
<groupId>org.projectlombok</groupId>
33
<artifactId>lombok</artifactId>
34
<version>1.18.6</version>
35
<scope>provided</scope>
36
</dependency>
37
</dependencies>
38
39
<!-- https://github.com/dirask/spring-boot-web-jsp-example -->
40
<build>
41
<finalName>${project.artifactId}</finalName>
42
<plugins>
43
<plugin>
44
<groupId>org.apache.maven.plugins</groupId>
45
<artifactId>maven-compiler-plugin</artifactId>
46
<version>3.7.0</version>
47
<configuration>
48
<annotationProcessorPaths>
49
<path>
50
<groupId>org.projectlombok</groupId>
51
<artifactId>lombok</artifactId>
52
<version>1.18.6</version>
53
</path>
54
</annotationProcessorPaths>
55
<source>${maven.compiler.source}</source>
56
<target>${maven.compiler.target}</target>
57
<verbose>true</verbose>
58
</configuration>
59
</plugin>
60
</plugins>
61
</build>
62
63
</project>
Note:
provided
scope
used withlombok
prevents embedding into the output JAR package.