10 February 2017

Lombok is used to reduce the amount of code that needs to be written, by using annotations Lombok is able to generate lots of boiler plate code quickly and easily. Not only is this useful for speeding up development but it also reduces the risk of mistakes and typos throughout the code as well as making it more readable.

There are few steps however to get Lombok working in intellij:

Step 1 - Adding the plugin

Adding the plugin into intellij is very straight forward simply open the preferences window and navigate to plugins; search for the lombok plugin and install it. Intellij needs to restart for it to be added.

Step 2 - Allow processing of annotations

Now the Lombok plugin is added processing of the annotations needs to be handled. In the preferences window again navigate to Build, Execution, Deployment -> Compiler -> Annotations Processor (in the sidebar) and now check the box to enable annotation processing.

Step 3 - Ensure that Lombok is a dependency

Last step is to ensure Lombok is in the maven dependencies add the following to the pom file:

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

Set the version to whatever is needed, in my case it’s 1.16.6.


Categories

Tags