Reputation:
I am aware what Lombok is, it minimizes boilerplate code through the use of some annotations. Lombok generates the equivalent Java code at compile time by using Java internals [Ref]. Hence it does not need any explicit plugin or Maven/Gradle build phase during compile time.
On looking at the pom.xml of a Spring Boot Project, I see below plugins section and am wondering what this exclusion is about.
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
Upvotes: 6
Views: 1792
Reputation: 6063
Well, the problem is following: Lombok is an annotation processor, and the code generated with/by Lombok does not depend on Lombok anymore. In Maven terms that means the dependency on Lombok should have provided
scope (in order to not include the Lombok jar into the target artifact). Unfortunately, the Spring developers have another opinion about dependencies with scope=provided
. Please check this conversation: Maven requires plugin version to be specified for the managed dependency spring-boot-configuration-processor
So, your configuration explicitly removes the Lombok jar from the target artifact.
Upvotes: 9