diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2017-05-08 21:28:02 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2017-05-29 21:02:54 +0200 |
commit | 8b7a7cbc813653a3248d6cf3a7779e220957bc85 (patch) | |
tree | b9acfb9d68c6866acc3cfb9ee59d72ff43f1ebc3 /website/templates/features/delombok.html | |
parent | 72fd50b9f1db1ab6bfc1753ba6a1e686a2f0f22c (diff) | |
download | lombok-8b7a7cbc813653a3248d6cf3a7779e220957bc85.tar.gz lombok-8b7a7cbc813653a3248d6cf3a7779e220957bc85.tar.bz2 lombok-8b7a7cbc813653a3248d6cf3a7779e220957bc85.zip |
The great rename: the old ‘website’ is now ‘website-old’, and ‘website2’ is now ‘website’.
Diffstat (limited to 'website/templates/features/delombok.html')
-rw-r--r-- | website/templates/features/delombok.html | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/website/templates/features/delombok.html b/website/templates/features/delombok.html new file mode 100644 index 00000000..fc9dfddc --- /dev/null +++ b/website/templates/features/delombok.html @@ -0,0 +1,61 @@ +<#import "_features.html" as f> + +<@f.scaffold title="Delombok" logline=""> + <@f.overview> + <p> + Normally, lombok adds support for all the lombok features directly to your IDE and compiler by plugging into them.<br /> + However, lombok doesn't cover all tools. For example, lombok cannot plug into javadoc, nor can it plug into the Google Widget Toolkit, both of which run on java sources. Delombok still allows you to use lombok with these tools by preprocessing your java code into java code with all of lombok's transformations already applied. + </p><p> + Delombok can of course also help understand what's happening with your source by letting you look at exactly what lombok is doing 'under the hood'. + </p><p> + Delombok's standard mode of operation is that it copies an entire directory into another directory, recursively, skipping class files, and applying lombok transformations to any java source files it encounters. + </p><p> + Delombok's output format can be configured with command line options (use <code>--format-help</code> for a complete list). A few such options are automatically scanned from input if possible (such as indent). If delombok's formatting is not conforming to your preferred code style, have a look! + </p> + + <h3>Running delombok on the command line</h3> + + <p> + Delombok is included in <code>lombok.jar</code>. To use it, all you need to run on the command line is: + <div class="snippet"> + <pre>java -jar lombok.jar delombok src -d src-delomboked</pre> + </div><br /> + Which will duplicate the contents of the <code>src</code> directory into the <code>src-delomboked</code> directory, which will be created if it doesn't already exist, but delomboked of course. Delombok on the command line has a few more options; use the <code>--help</code> parameter to see more options. + </p><p> + To let delombok print the transformation result of a single java file directly to standard output, you can use: + <div class="snippet"> + <pre>java -jar lombok.jar delombok -p MyJavaFile.java</pre> + </div> + </p> + + <h3>Running delombok in ant</h3> + + <p> + <code>lombok.jar</code> includes an ant task which can apply delombok for you. For example, to create javadoc for your project, your <code>build.xml</code> file would look something like: + <div class="snippet"><pre><target name="javadoc"> +<taskdef classname="lombok.delombok.ant.Tasks$Delombok" classpath="lib/lombok.jar" name="delombok" /> +<mkdir dir="build/src-delomboked" /> +<strong><delombok verbose="true" encoding="UTF-8" to="build/src-delomboked" from="src"></strong> + <strong><format value="suppressWarnings:skip" /></strong> +<strong></delombok></strong> +<mkdir dir="build/api" /> +<javadoc sourcepath="build/src-delomboked" defaultexcludes="yes" destdir="build/api" /> +</target></pre> + </div><br /> + Instead of a <code>from</code> attribute, you can also nest <code><fileset></code> nodes. + </p> + + <h3>Running delombok in maven</h3> + + <p> + Anthony Whitford has written a <a href="https://github.com/awhitford/lombok.maven">maven plugin</a> for delomboking your source code. + </p> + + <h3>Limitations</h3> + + <p> + Delombok tries to preserve your code as much as it can, but comments may move around a little bit, especially comments that are in the middle of a syntax node. For example, any comments appearing in the middle of a list of method modifiers, such as <code>public /*comment*/ static ...</code> will move towards the front of the list of modifiers. In practice, any java source parsing tool will not be affected.<br /> + To keep any changes to your code style to a minimum, delombok just copies a source file directly without changing any of it if the source file contains no lombok transformations. + </p> + </@f.overview> +</@f.scaffold> |