Using Lombok in a NetBeans Platform project with Maven
Join the DZone community and get the full member experience.
Join For FreeLombok is a nice annotation processor for generating boilerplate code, such as getters and setters. It's pretty straightforward to use, especially if you're using Maven as you only need a few extra declarations in the pom. After some experimenting, I've started using it with my NetBeans Platform projects and it worked fine, with only a small tip to be taken care.
As per the Lombok documentation, usually you only need to put this in your pom:
<repositories>
...
<repository>
<id>projectlombok.org</id>
<name>Lombok Repository</name>
<url>http://projectlombok.org/mavenrepo</url>
</repository>
</repositories>
<dependencies>
...
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
It works, but the Maven NBM plugin will embed the lombok jar into the generated .nbm. To avoid that, you just need to add the scope element as below:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
Opinions expressed by DZone contributors are their own.
Trending
-
Scaling Site Reliability Engineering (SRE) Teams the Right Way
-
Hiding Data in Cassandra
-
Docker Compose vs. Kubernetes: The Top 4 Main Differences
-
Constructing Real-Time Analytics: Fundamental Components and Architectural Framework — Part 2
Comments