If you visit official Lombok Maven guide, you will see that it's scope should be provided
.
When I create a new project from scratch using start.spring.io and add Lombok, it gets only <optional>true</optional>
in resulting pom.
Then I package Spring boot app like this and out of curiosity decide to see what gets packaged inside of jar:
mvn clean package -DskipTests=true && unzip target/demo-0.0.1-SNAPSHOT.jar -d exploded
Lombok is packaged, does not matter if I set scope to provided
or only have optional=true
.
How to prevent Lombok from being included to Spring Boot jar?
My last thought was to try another goal which comes with Spring Boot plugin:
mvn spring-boot:repackage
But unfortunately it produces the following error:
repackage failed: Source file must be provided