Lombok

How to configure Lombok with maven-compiler-plugin?

混江龙づ霸主 提交于 2019-12-03 13:06:54
I have a root module and submodule in maven in the project. I am trying to use Lombok. I have added <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.16.12</version> <scope>provided</scope> </dependency> to root pom.xml. In submodule I have a class with Lombok annotations. When I am trying to build the project I get a lot of cannot find symbol where I am trying to call getters and setters. I have tried to use lombok-maven-plugin with same version (1.16.12) in root pom and in the sub pom as well with delombok and moving my annotated class to src/main

How to create default constructor for immutable class

ε祈祈猫儿з 提交于 2019-12-03 13:06:42
I like to make my objects immutable based on this article (Why objects must be immutable) . However, I am trying to parse an object using Jackson Object Mapper. I was initially getting JsonMappingException: No suitable constructor found for type [simple type, class ]: cannot instantiate from JSON object. I could fix it as mentioned here , by providing a default constructor and making my fields non-final. import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; @AllArgsConstructor //

Lombok and STS issue - Method undefined

末鹿安然 提交于 2019-12-03 12:41:26
I have STS versioned 3.6.3.SR1 that's based on Eclipse Luna 4.4.1. I have did the following steps: 1) Donwload and run the lombak runnable jar and gave the path of my STS. 2) I verified the entries of vmargs, but was missing Xbootclasspath and added it to have like, -vmargs -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Dorg.eclipse.swt.browser.IEVersion=10001 -Xms512m -Xmx1024m -javaagent:C:\tools\Lombok\lombok.jar -Xbootclasspath/a:C:\tools\Lombok\lombok.jar 3) I have exit and opened the STS both from shortcut as well as the absoulte location of the STS.exe 4) I verified the outline of

Lombok and AspectJ

心已入冬 提交于 2019-12-03 11:24:13
Im trying to use Lombok in combination with AspectJ and Maven. So, what's the problem? When i use the AspectJ Maven Plugin (www.mojohaus.org/aspectj-maven-plugin/), it takes the sources and compiles them and ignores changes made by Lombok. I followed this tutorial and came up with this code and AspectJ works, but Lombok dies with this message: [WARNING] You aren't using a compiler supported by lombok, so lombok will not work and has been disabled. Your processor is: org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.BatchProcessingEnvImpl Lombok supports: sun/apple javac 1.6, ECJ So,

What are the risks with Project Lombok?

扶醉桌前 提交于 2019-12-03 10:32:14
问题 I'm coming up with performance goals for the new year, and I thought I'd be fun to put a goal to reduce the size of the code base, especially boilerplate. One action I've come up with to address this is to use Project Lombok to make beans as short as they should be. But I have a habit of overlooking downsides to new software and approaches, so I'm relying on the Stack Overflow community: Can anyone tell me why Lombok is a bad idea? 回答1: A major downside is IDE support. Since Lombok is not

View lombok generated code in IntelliJ IDEA

五迷三道 提交于 2019-12-03 10:26:31
I have the lombok plugin setup in IntelliJ and my code builds fine. I can see the lombok generated methods in the structure view. What I want is some way to actually see the source lombok generates for each of the methods. I realize I can delombok the file but I'm wondering if there is some way I can flip a switch to show or hide the lombok generated code. Just in case somebody ends up looking for an answer here. With lombok plugin starting with v0.8.6 it is possible. Lombok comes with a ' delombok ' feature that you an use as follows: java -jar lombok.jar delombok -p MyJavaFile.java 来源: https

How to exclude property from Lombok builder?

↘锁芯ラ 提交于 2019-12-03 10:22:16
I have a class called as "XYZClientWrapper" , which have following structure: @Builder XYZClientWrapper{ String name; String domain; XYZClient client; } What I want no build function generated for property XYZClient client Does Lombok supports such use case? Yes, you can place @Builder on a constructor or static (factory) method, containing just the fields you want. Disclosure: I am a Lombok developer. Alternatively, I found out that marking a field as final , static or static final instructs @Builder to ignore this field. @Builder public class MyClass { private String myField; private final

JaCoCo: exclude generated methods (using it with Lombok)

左心房为你撑大大i 提交于 2019-12-03 09:55:10
I am using JaCoCo and it is considering methods generated by Lombok (generated in the bytecode, not trace of them in the source code). How can I configure JaCoCo to ignore them? Use the excludes tag provide by jacoco. <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.4.201502262128</version> <configuration> <excludes> <exclude>**/config/**</exclude> <exclude>**/model/**</exclude> <exclude>**/item/**</exclude> </excludes> </configuration> ebonnet Also another way to exclude lombok generated classes since jacoco 0.8.0 and lombok 1.16.14 see: https://www.rainerhahnekamp.com/en/ignoring

Adding Lombok plugin to IntelliJ project [duplicate]

南楼画角 提交于 2019-12-03 08:14:40
问题 This question already has answers here : Lombok annotations do not compile under Intellij idea [duplicate] (11 answers) Closed 3 months ago . I'm trying to add Lombok to my Spring Boot project in IntelliJ IDEA. So far, I've added the plugin under Settings - Plugins (version 0.13.16) added compile('org.projectlombok:lombok') to my Gradle dependencies enabled annotation processing It still doesn't recognize either the Lombok import or the annotations. What am I missing? Solved: I had to run an

Error: package javax.annotation does not exist after upgrade to lombok 1.16.2

我是研究僧i 提交于 2019-12-03 05:28:01
问题 My android project builds fine with lombok 1.16.0, but once I change my dependency to target 1.16.2, I get the following error everywhere I'm using a lombok annotation: Error:(20, 1) error: package javax.annotation does not exist The Android SDK does not include all javax packages. What I'm wondering is if this is a bug in 1.16.2 or do I now have to add a dependency to javax.annotation ? Note: This is in Android Studio with Lombok plugin 0.8.8 回答1: You can disable the generation of javax