If you are using java for your development projects, you probably will know how handy IntelliJ IDEA IDE is. Devs tired of writing lengthy getters and setters use Lombok library.
IntelliJ IDEA is a much-loved IDE by Spring framework developers.
In this post I am going to share how to use Lombok plugin in IntelliJ IDEA.
First to understand what Lombok is, here is an extract from the official website of the Lombok project:
Project Lombok is a java library that automatically plugs into your editor and builds tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a fully-featured builder, Automate your logging variables, and much more.Project Lombok
Lombok is used basically to automate getters and setters of variables required for your project. It not only reduces the code length but also eliminates the tendency to miss any of them.
If you check out the official website of the Lombok project, you will see that it IntelliJ IDEA supports Lombok library.
How to use Lombok in IntelliJ IDEA Plugin
Here’s how to add the plugin in IntelliJ IDEA.
Like adding any other libraries in java projects, depending on what build tool you use, you have to add it to your project.
For example, if you are using a maven build tool, add the following code in your
pom.xml file (in your
Code language: HTML, XML (xml)
<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency>
Based on your requirements, you can explore how to add it to your projects from the link project Lombok official website.
After adding Lombok dependency to your project, this is what you should do.
- Go to
File > Settings > Plugins
- Click on
- Search for
- Click on
- Restart IntelliJ IDEA
After restarting your IDE, you will able to use
Kuzu Zangpo la! I am Sonam Dargay. I am a full-time software developer. Apart from 9-5 office works, I am a tech enthusiast, blogger, and dreamer.
I graduated from the College of Science and Technology(CST), affiliated with the Royal University of Bhutan.