I try to configure a Maven project to fail when a Lombok usage is flagged as ERROR on lombok.config
But it only writes an INFO log with the error message, it doesn't fail the build. Is there a configuration for that ?
Here is a sample project. Regards.
lombok.config
config.stopBubbling = true
lombok.data.flagUsage = ERROR
src/main/lombok/Example.java
@lombok.Data
public class Example {
private String msg;
}
src/main/java/Test.java
public class Test {
public static void main(String[] args) {
Example ex = new Example();
ex.setMsg("Hello");
}
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>example</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>1.18.12.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
mvn compile
[INFO] Scanning for projects...
[INFO] ------------------------< org.example:example >-------------------------
[INFO] Building example 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] --- lombok-maven-plugin:1.18.12.0:delombok (default) @ example ---
example\src\main\lombok\Example.java:1: error: Use of @Data is flagged according to lombok configuration.
@lombok.Data
^
[INFO] Delombok complete.
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory example\src\main\resources
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ example ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to example\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------