Installing Lombok
Published: 2018-10-13 16:16:24

---
title: Installing Lombok
published: true
tags: 
canonical_url: https://committed.software/posts/lombok/lombok/
---

[![Lombok, Indonesia](https://committed.software/static/atilla-taskiran-386870-342da5d49e5aaf02d48045b3454abe69-f3a32.jpg)](/static/atilla-taskiran-386870-342da5d49e5aaf02d48045b3454abe69-7a1db.jpg)

[Lombok](https://projectlombok.org/) is now used in Spring Cloud and though many Java developers have avoided it, the idea of dropping boilerplate appeals to us all. Now that we have lambdas in JDK 8 now is a good time to take the extra step to reduce the fat even further.

There’s seems to be a lot [problems](http://stackoverflow.com/questions/22310414/how-to-configure-lombok-in-eclipse-luna) with the install, so we’ve put together a guide from our install experience for Eclipse Mars or Spring Tool Suite.

<!--more-->

Close Eclipse and Spring Tool Suite if they are running.

Download Lombok from their [website](https://projectlombok.org/download.html). Then you should run the lombok.jar:

```
java -jar lombok.jar
```

You’ll be presented with a small GUI which asks you to select your Eclipse installs. If you’ve installed to a default place it might find them automatically, but assuming not then you should Browse and select the _ini_ file - that is eclipse.ini or STS.ini.

The Lombok installer will add a few lines to the ini file:

```
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.7
-Xms40m
-XX:MaxPermSize=256m
-Xverify:none
-Xmx1200m
-javaagent:/path/to/sts-bundle/sts-3.7.1.RELEASE/lombok.jar
```

We use Java 8, so have changed the line above to read `-Dosgi.requiredJavaVersion=1.8`. Save the file.

Normally you run Eclipse/STS through the GUI but for once we need to run through the command line. Assuming that you have these installed on the PATH (if not, you should navigate to the install directory and run from there) then you can run :

```
# If you run Eclipse
eclipse -clean

# If you run STS
STS -clean
```

On Ubuntu running from the command line seems to work find but not from the launcher (ie from Unity menu). It the the Unity launcher script just goes straight to the Jar file and it also overrides some settings. See the Exec line in the file ~/.local/share/applications/spring-tool-suite.desktop (or eclipse.desktop):

```
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Spring - Spring Tool Suite
Icon=spring_tool_suite.png
Path=/path/to/Applications/sts-bundle/sts-3.7.1.RELEASE
Exec=/usr/bin/java -D...lots of defines here... -jar /path/tp/sts-bundle/sts-3.7.1.RELEASE//plugins/org.eclipse.equinox.launcher_1.3.100.v2015$
StartupNotify=false
StartupWMClass=Spring Tool Suite
OnlyShowIn=Unity;
X-UnityGenerated=true
```

We change the Exec line to:

```
Exec=/path/to/Applications/sts-bundle/sts-3.7.1.RELEASE/STS
```

Finally when you get into eclipse run Project \> Clean \> All projects and then Maven Update all projects.

This comprehensive/belt and braces worked for us, but seems to work!

Credit: Photo by [Atilla Taskiran](https://unsplash.com/photos/8Qz2rYSF_dE?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)