User Tools

Site Tools


lombok

Lombok is a library written for Java used to automate many common task when programming.

The url project is https://projectlombok.org/ and it is free to use. It can be used with eclipse IntelliJ and netbeans among others.

The magic happens in building time, so there is no need to include the jar in the deployed version. It is what maven calls a provieded dependency.

To install it in eclipse you have to execute the downloaded jar (with java -jar or double click) and pick the current eclipse installation. You have to restart eclipse and you can see it is installed if you go to the installed componentes and see it on this list.

In addition, it is required that you import the library to your project. For example, in maven you have to write somthing like that

	<dependency>
		<groupId>org.projectlombok</groupId>
		<artifactId>lombok</artifactId>
		<version>1.18.12</version>
		<scope>provided</scope>
	</dependency> 

And if you are in eclipse you have to do Maven→Update project and Run → Clean and Run → Install

Sometimes happens that maven downloads incorrectly the library. Then eclipse doesn't recognize the lombok annotations. The way to discover that is that when you run the maven install, you'll see an error regarding that like

[ERROR] error: error reading C:\Users\xxx\.m2\repository\org\projectlombok\lombok\1.18.12\lombok-1.18.12.jar; invalid LOC header (bad signature)

The solution is to remove manually the projectlombok folder and run maven install again. It will download again it and the error will be gone.

lombok.txt · Last modified: 2020/07/02 19:49 by admin