Lombok is not working in intellij
What you will learn here about Lombok
- Lombok is not working in intellij
Generally we getters and setters methods in our code for reading and setting up the values of instance variables. These getters and setters methods we can replace with @Getters and @Setters annotations respectively by using lombok framework.
So when we try to use lombok in our project we get errors like
- Lombok not generating getters and setters intellij or
- Cannot resolve symbol Getters or
- Cannot resolve symbol Setters or
You get Cannot resolve symbol Getters or Cannot resolve symbol Setters or Lombok not generating getters and setters in intellij even you have added maven dependency of lombok because lombok jar is not getting download automatically. So here
we will see how to solve Cannot resolve symbol Getters or Cannot resolve symbol Setters errors in intellij.
Lombok is not working in intellij
Please follow the following steps to know how to solve lombok is not working issue in intellij.
1)Assuming you know how to create maven project in intellij and you have created maven project
2)you also added maven dependency of lombok in your projects POM.xml which is shown below
<dependencies> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.20</version> <scope>provided</scope> </dependency> </dependencies>
3)You have added lombok dependencies but still you are getting error like cannot reslove symbol Getters which is shown below
4)Now please follow the following steps to slove cannot reslove symbol Getters and cannot reslove symbol Setters problem in intellij which is shown below
Click on File -> Settings -> Tools -> Shared Indexes -> then select Download automatically under Maven Libraries -> Apply -> OK
5)Now build your project which is shown below
Right click on Project -> Build Module <Your Project Name>
6)After the Build just @Getters and @Setters annotations in your code again and it should work which is shown below
Frequently Ask Questions
how to replace getters and setters methods in java
Answer: Yes, you can replace getters and setters methods in java by using Lombok. Follow above steps to know how use Lombok in your code.