How to configure Lombok with maven-compiler-plugin?

This is not a direct answer to the question which seems to be solved but acts as reference for future searchers: If you’re using Dagger (or something else) to process your annotations like <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.7.0</version> <configuration> <annotationProcessorPaths> <path> <groupId>com.google.dagger</groupId> <artifactId>dagger-compiler</artifactId> <version>2.15</version> </path> </annotationProcessorPaths> <source>1.8</source> <target>1.8</target> </configuration> </plugin> …. </plugins> </build> You … Read more

sonarqube + lombok = false positives

This case should be perfectly handled by SonarJava. Lombok annotations are taken into account at least since version 3.14 (SONARJAVA-1642). The issues you are getting are resulting from a misconfiguration of your Java project. No need to write any custom rules to handle this, this is natively supported by the analyzer. SonarJava reads bytecode to … Read more

How to override Lombok Setter methods

Either you just hit a bug I’ve never seen or you’re testing it wrong. An annotation like @Setter(AccessLevel.NONE) private String age; on the field level indeed stops the setter from being generated. But given that you’re defining a setter, you don’t even need it. An explicit @Setter stops the generation, too. I’ve just tried your … Read more

Omitting one Setter/Getter in Lombok

You can pass an access level to the @Getter and @Setter annotations. This is useful to make getters or setters protected or private. It can also be used to override the default. With @Data, you have public access to the accessors by default. You can now use the special access level NONE to completely omit … Read more

Build an object from an existing one using lombok

You can use the toBuilder parameter to give your instances a toBuilder() method. @Builder(toBuilder=true) class Foo { int x; … } Foo f0 = Foo.builder().build(); Foo f1 = f0.toBuilder().x(42).build(); From the documentation: If using @Builder to generate builders to produce instances of your own class (this is always the case unless adding @Builder to a … Read more

how to configure lombok in eclipse luna

Disclosure: I am one of the lombok developers. I might be biased 🙂 I strongly suggest installing Lombok via executing the lombok jar: java -jar lombok.jar The spaces in the path might be a problem. Also, you’ll need to use lombok version 1.14.8 (or higher) to have Luna support. Please check in the About Eclipse … Read more