Lombok, Maven, and NetBeans

Here's a POM that incorporates Lombok:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 

For adding the Lombok dependency above, you're able to add the @Data annotation from Lombok. The Navigator in NetBeans automatically shows all the getters and setters made available by Lombok, which you don't need to code and maintain yourself because they're not in your code. Click to enlarge the image below.

Now you can use all those getters and setters without ever having coded them, for example:

public class Main {

    public static void main(String[] args) {
        MyBooks mb = new MyBooks(1850, "Tale of Two Cities", "Dickens");
        String title = mb.getTitle();
        String author = mb.getAuthor();
        int year = mb.getYear();
        System.out.println("title = " + title);
        System.out.println("author = " + author);
        System.out.println("year = " + year);


Use code completion in the version element of the POM to check what the latest Lombok JAR version is:

In the Services window, you can explore the Maven repo:

In "Local" above, after building the project which downloads the dependencies you've declared, you'll find the Lombok JAR declared in the POM:

In "Central Repository", you'll find all the Lombok JARs, which explains the code completion results, i.e., that's where they come from:

Simple, smooth, intuitive integration of Maven, and from Maven to Lombok, in NetBeans IDE.


some experimental features aren't work in NetBeans, but anyway good thing

Posted by guest on September 03, 2014 at 02:29 PM PDT #

Which experimental features are you talking about? I don't believe NetBeans has any experimental features, so I'm curious to know what you're talking about.

Posted by Geertjan on September 04, 2014 at 10:49 AM PDT #

I have forgotten what exactly didn't work (compile error in ide editor) cause I have been testing Lombok a year ago, but it's likely was from page
some annotations worked well despite documentation awareness, but one or two was really unusable.

Posted by guest on September 04, 2014 at 02:55 PM PDT #

Well, completely impossible to help you with the description you've provided so far. Let me know when you have something that can be reproduced today, i.e., not something random you did last year.

Posted by Geertjan on September 06, 2014 at 06:57 AM PDT #


Posted by Mehul Boricha on September 28, 2014 at 09:48 AM PDT #

I also looked at Project Lombok but deemed it too risky to use (f.x. there are issues with the latest JDK). I also found the customisation features lacking, so I just released my own open source tool for generating java value objects (with getters, setters, constructors, equals, hash, compareTo and more) that used 100% standard java features, integrates with all java tools and is extremely customisable. You can check it out at "http://valjogen.41concepts.com". Let me know what you think?

Posted by Morten Christensen on October 22, 2014 at 12:11 PM PDT #

I love to use lombok on netbeans (my favorite IDE). But the ExtensionsMethod feature do not have auto-complete on Netbeans. It make my partner must take a time to look for my function in Extension.class.
Hope, it will work soon.

Posted by guest on June 09, 2016 at 01:09 AM PDT #

Hi Geertjan, I am trying to use lombok in netbeans 8.2 nightly build (17th june 2016). But I can't find the option of Enabling Annotation Processing in maven project. could you help with that ?

Posted by Rahul khandelwal on June 17, 2016 at 05:33 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« July 2016