Introduction to Project Lombok
Project Lombok is a Java library that will be plugged into your code editor which automatically generates Java boilerplate byte code for you based on a couple of annotations.
Incase you're using maven as your dependency management tool, Project Lombok can easily be integrated in your project by adding code below in your pom.xml file.
<dependencies> <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.8</version> <scope>provided</scope> </dependency> </dependencies>
It's also possible to integrate this library in your favorite IDE or text editor. i.e
For purpose of demonstration. Let's integrate this library in Eclipse.
# Integrating Project Lombok in Eclipse
NOTE: The instructions below assume you already have eclipse ide for java ee installed on your machine.
As of writing,
Eclipse IDE 2019‑06 is the latest version.
- Locate where your maven local repository is located to find project lombok's jar file.
- For Windows
- For Unix systems
- For windows, Double-click the jar file i.e lombok-1.18.8.jar to open it up.
- In the window that opens up, a list of installed IDEs show up.
- After selecting your IDE in the list, Click Install/Update button.
- After installing, Quit the Installer window. And restart your IDE.
To verify that lombok is enabled, Click >> Help tab >> About >> You should be able to see the lombok version right at the bottom of the text displayed in the "About Eclipse Window". i.e
"Lombok 1.16.13 'Edgy Guinea Pig' 2016-12-13 is installed https://projectlombok.org"
- That's it for today. Don't hesitate to leave a comment. Your feedback is greatly appreciated.
TIP: You could alternatively get the jar file from Lombok's download page.
You could also use this same jar file to uninstall lombok from your IDE.
"your-username"i.e John and
"lombok-version-no"i.e 1.18.8 with their respective names.
TIP: This is the default path but it may be different depending on a change in installation path settings.
In case a list doesn't show up, Close Can't find IDE window >> Click Specify location... button and navigate to your custom IDE installation directory location.
- How To Use @Data Annotation With Project Lombok In Java Applications
- How To Use @Getter And @Setter Annotations With Project Lombok
- How To Use @Value Annotation With Project Lombok In Java Applications
- How To Use @AllArgsConstructor Annotation With Project Lombok In Java Applications
- How To Use @EqualsAndHashCode Annotation With Project Lombok
- How To Use @NonNull Annotation With Project Lombok In Java Applications
- How To Use @FieldDefaults Annotation With Project Lombok In Java Applications
- How To Install Project Lombok In Apache Netbeans
- Build Your First Android App (With No Step Skipped)
- Writing Your First Lambda Expression For Beginners In Java