Plugin page: http://artifacts.griffon-framework.org/plugin/lombok
Allows bytecode manipulation at compile time using Project Lombok. Think of Lombok as AST transformations for Java sources.
Supports Javac and Eclipse JDT. Works with Intellij IDEA, Eclipse and NetBeans.
The Lombok plugin supports the following transformations
@ThreadingAware
- injects thegriffon.core.ThreadingHandler
interface@ResourcesAware
- injects thegriffon.core.ResourceHandler
interface@EventPublisher
- injects thegriffon.core.EventPublisher
interface@Bindable
- injects thegriffon.core.Observable
interface@Vetoable
- injects thegriffon.core.Vetoable
interface@MVCAware
- injects thegriffon.core.MVCHandler
interface@MessageSourceAware
- injects thegriffon.core.i18n.MessageSource
interface@ResourceResolverAware
- injects thegriffon.core.resources.ResourceResolver
interface
In the case of @Bindable
and @Vetoable
there are a couple of limitations at
the moment that don't make it work exactly as its Groovy counterpart:
- Java has no concept of properties like Groovy does,
@Bindable
expects all private fields to be properties.
Additional transformations provided by lombok-pg are also available by installing this plugin.
Support for this compiler is provided out-of-the-box by the command line tools. There's no additional configuration required.
Follow these steps to setup Lombok in Eclipse
-
Make sure the project has the required files to be opened as an Eclipse Project. Simply call the following command
griffon integrate-with --eclipse
-
Install the eclipse-support plugin and update the
.classpath
filegriffon install-plugin eclipse-support griffon eclipse-update
-
Open the project in Eclipse
-
Locate the
lombok-x.y.z.jar
in the project libraries. Right click on it, run it as a Java application. Selectlombok.core.Main
as the class to launch. Follow the on-screen instructions. Make a not of the install path as you'll need it in the next step. Shutdown Eclipse. -
Go to the path where the
lombok.jar
was copied. This path is either found inside the Eclipse installation directory or in your local settings. Copy the following files from the project's working directory$ cp $USER_HOME/.griffon/<version>/projects/<project>/plugins/lombok-<version>/dist/griffon-lombok-compile-<version>.jar . $ cp $USER_HOME/.ivy2/cache/com.github.peichhorn/lombok-pg/jars/lombok-pg-<version>.jar .
-
Edit the launch script for Eclipse and tweak the boothclasspath entry so that includes the file you just copied
-Xbootclasspath/a:lombok.jar:lombok-pg-<version>.jar:griffon-lombok-compile-<version>.jar
-
Launch Eclipse once more.
Follow the instructions found in Annotation Processors Support in the NetBeans
IDE, Part I: Using Project Lombok. You may need to specify
lombok.core.AnnotationProcessor
in the list of Annotation Processors.
Follow these steps to setup Lombok in Intellij IDEA
-
Download the latest stable release of lombok-intellij-plugin as a zip file.
-
Open up the Preferences dialog in IntelliJ IDEA
-
Go to the Plugins page. Click on the "Install plugin from disk..." button. Select the zip file you just downloaded.
-
Shutdown IntelliJ IDEA; locate the directory where the lombok plugin was installed. This directory is usually found somewhere inside your personal settings. In OSX for example it would be located in
$USER_HOME/Library/Application Support/IntelliJIdea11/lombok-plugin
. -
Copy
griffon-lombok-compile-<version>.jar
to thelib
directory$ pwd $USER_HOME/Library/Application Support/IntelliJIdea11/lombok-plugin $ cp $USER_HOME/.griffon/<version>/projects/<project>/plugins/lombok-<version>/dist/griffon-lombok-compile-<version>.jar lib
-
Launch IntelliJ IDEA once more.
This project requires all of its dependencies be available from maven compatible repositories. Some of these dependencies have not been pushed to the Maven Central Repository, however you can obtain them from lombok-dev-deps.
Follow the instructions found there to install the required dependencies into your local Maven repository before attempting to build this plugin.