From bb85d799b3ba549c8a29afab0b246cb13b10507a Mon Sep 17 00:00:00 2001
From: Reinier Zwitserloot
+ Android development with lombok is easy and won't make your android application any 'heavier' because lombok is a compile-time only library. It is important to configure your android project properly to make sure lombok doesn't end up in your application and waste precious space on android devices.
+
+ The instructions listed below are excerpts from The
+ AndroidAnnotations project cookbook. You may wish to refer to that documentation for complete instructions; lombok is just
+ the equivalent to
+ ${title}
+
+ <#nested>
+ ${title}
+ androidannotations-VERSION.jar
; there is no -api
aspect.
+
+ >= 0.4.3
+ dependencies
block:
+
+ provided "org.projectlombok:lombok:${version}"
+
+ apt
directive) in the dependencies
block:
+
+ provided "org.projectlombok:lombok:${version}"
+ apt "org.projectlombok:lombok:${version}"
+
+
+ Follow the previous instructions (Gradle). In addition to setting up your gradle project correctly, you need to add the Lombok IntelliJ plugin to add lombok support to Android Studio: +
File > Settings > Plugins
+ Browse repositories...
+ Lombok Plugin
+ Install plugin
+
+ In eclipse, create a 'lightweight' lombok jar that contains only the annotations by running:
+
+java -jar lombok.jar publicApi+ Then, add the
lombok-api.jar
file created by running this command to your android project instead of the complete lombok.jar
, and, as usual, install lombok into eclipse by double-clicking lombok.jar
.
+
+ @s.section>
+
+ <@s.section title="Maven">
+
+ You should be able to just follow the normal lombok with maven instructions.
+ Note that if you use android, eclipse, and maven together you may have to replace lombok.jar
in your eclipse android project's build path (which you can modify in that project's properties page) with lombok-api.jar
, as produced in the procedure explained for Eclipse, above.
+
+
build.xml
in ${r"${ANDROID_SDK_ROOT}"}/tools/ant/build.xml
and copy the -compile
target into the paste buffer.
+ build.xml
of your own project, right before the <import file="${r"${sdk.dir}"}/tools/ant/build.xml">
line.
+ compile-libs
directory in your own project and copy the complete lombok.jar
to it.
+ <classpath>
entry inside the <javac>
task in the -compile
target you just copied:<fileset dir="compile-libs" includes="*.jar" />
to it.
+ + ecj (the eclipse standalone compiler) is compatible with lombok. Use the following command line to enable lombok with ecj: +
java -javaagent:lombok.jar=ECJ -jar ecj.jar -cp lombok.jar -source 1.8 (rest of arguments)+
+ You may have to add the following VM argument, if you're using an older version of lombok or java: +
-Xbootclasspath/p:lombok.jar+
+ If you're using a tool based on ecj, adding these VM arguments and adding lombok.jar to the classpath should work. +
+ @s.introduction> + + <@s.section title="Maven"> +
+ It is possible to configure maven-compiler-plugin
with maven-dependency-plugin
and plexus-compiler-eclipse
.
+
+ Before the compile
phase, you will have to set your MAVEN_OPTS
environment variable to include the javaagent
argument. In the example below, target
is your ${r"${project.build.directory}"}
.
+
+ Use the following commands in sequence to enable lombok with ecj in your Maven build: +
+mvn clean dependency:copy@get-lombok +set MAVEN_OPTS=-javaagent:target/lombok.jar=ECJ (or your OS's equivalent) +mvn install +set MAVEN_OPTS= (or your OS's equivalent) ++ + @s.section> +@s.scaffold> diff --git a/website2/templates/setup/eclipse.html b/website2/templates/setup/eclipse.html new file mode 100644 index 00000000..85304c83 --- /dev/null +++ b/website2/templates/setup/eclipse.html @@ -0,0 +1,26 @@ +<#import "_setup.html" as s> + +<@s.scaffold title="Eclipse, Spring Tool Suite, (Red Hat) JBoss Developer Studio, MyEclipse"> + <@s.introduction> +
+ The Eclipse editor is compatible with lombok. Eclipse offshoots are also compatible with lombok, specifically: +
+ Double-click lombok.jar (downloadable from this site, or from your maven repository; it's the same jar). This starts the eclipse installer which will find eclipse (and eclipse variants as listed above), and offers to install lombok into these eclipse installations. The same tool can also uninstall lombok:
+
+
+
+ You can check if your eclipse installation is lombok-enabled in eclipse's about dialog. The lombok version will be listed at the end of the copyright text:
+
+
+
+ GWT (Google Web Toolkit) is compatible with lombok. +
+ Edit your proj-debug
and proj-compile
batch scripts to add the following VM arguments:
+
+java -javaagent:lombok.jar=ECJ (rest of arguments) ++
+ Thanks to Stephen Haberman for figuring this out. +
+ @s.introduction> +@s.scaffold> diff --git a/website2/templates/setup/intellij.html b/website2/templates/setup/intellij.html new file mode 100644 index 00000000..0230c59a --- /dev/null +++ b/website2/templates/setup/intellij.html @@ -0,0 +1,22 @@ +<#import "_setup.html" as s> + +<@s.scaffold title="IntelliJ IDEA"> + <@s.introduction> ++ The Jetbrains IntelliJ IDEA editor is compatible with lombok. +
+ Add the Lombok IntelliJ plugin to add lombok support IntelliJ: +
File > Settings > Plugins
+ Browse repositories...
+ Lombok Plugin
+ Install plugin
+
+ Just put lombok on the classpath when compiling with any javac (version 1.6 - 1.8): javac -cp lombok.jar ....
+
+ Support for JDK9 is ongoing. You need to set up some configuration to make lombok play nice with jigsaw (the JDK9 module system). The github issue about JDK9 support for Lombok has the details on how to set it up. +
+ @s.section> +@s.scaffold> diff --git a/website2/templates/setup/netbeans.html b/website2/templates/setup/netbeans.html new file mode 100644 index 00000000..eccd9e93 --- /dev/null +++ b/website2/templates/setup/netbeans.html @@ -0,0 +1,16 @@ +<#import "_setup.html" as s> + +<@s.scaffold title="Netbeans"> + <@s.introduction> ++ The Netbeans editor is compatible with lombok. +
lombok.jar
to the project libraries.
+ Build – Compiling
, check the 'Enable Annotation Processing in Editor'
checkbox.
+