Issue
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/lombok, I have looked through almost all questions in SO, try all the variants, but not succeed.
I am using Maven 3, Java 8, maven-compiler-plugin with 3.6.1 version.
How should I configure the project to be able to use lombok? Or maybe I am doing smth wrong.
Solution
I was using Java 8 and @Getter(onMethod = @__({@NoSerialization}))
and @Getter(onMethod = @__({@Translation(messageKey = "translation.key")}))
onX annotations. And I get duplicate element '<any?>' in annotation @<any?>.
in error output. Looks like guys from Lombok have such issue with Java 8 for a long time link to issue on github. Lombok does not handle annotations with parameters like messageKey
in annotation above. it works only with annotations without parameters and annotations with only value
parameter (when you don't write the name of parameter).
Answered By - Oleksandr Zaiats
Answer Checked By - Marilyn (JavaFixing Volunteer)