From 6cc74e42295b6138629c6b32dd56a99ee8c2c646 Mon Sep 17 00:00:00 2001
From: Roel Spilker lombok.config file with their preferences in a workspace or project root directory, with the special config.stopBubbling = true key to tell lombok this is your root directory. You can then create lombok.config files in any subdirectories (generally representing projects or source packages) with different settings.
An up to date list of all configuration keys supported by your version of lombok can be generated by running: -
java -jar lombok.jar config -g --verbose
- java -jar lombok.jar config -g --verboselombok.config file.@@ -47,24 +47,24 @@
Configuration files are hierarchical: Any configuration setting applies to all source files in that directory, and all source files in subdirectories, but configuration settings closer to the source file take precedence. For example, if you have in /Users/me/projects/lombok.config the following:
-
lombok.log.fieldName = foobar
- lombok.log.fieldName = foobar/Users/me/projects/MyProject/lombok.config you have:
- lombok.log.fieldName = xyzzy
- lombok.log.fieldName = xyzzy@Log annotations will use foobar instead of the default log as a field name to generate in all your projects, except for your project in /Users/me/projects/MyProject, where xyzzy is used instead.
To restore a configuration key set by a parent config file back to the default, the clear option can be used. For example, if a parent configuration file has configured all use of val to emit a warning, you can turn off the warnings for a subdirectory by including in it a lombok.config file with:
-
clear lombok.val.flagUsage
- clear lombok.val.flagUsage
Some configuration keys take lists. For lists, use += to add an entry. You can remove a single item from the list (useful to undo a parent configuration file's setting) with -=. For example:
-
lombok.accessors.prefix += m_
- lombok.accessors.prefix += m_
Comments can be included in lombok.config files; any line that starts with # is considered a comment.
To stop lombok from looking at parent directories for more configuration files, the special key: -
config.stopBubbling = true
- config.stopBubbling = true
Lombok can add @javax.annotation.Generated annotations to all generated nodes where possible. You can enable this with:
-
lombok.addJavaxGeneratedAnnotation = true
- lombok.addJavaxGeneratedAnnotation = truetrue.
Lombok can be configured to add @lombok.Generated annotations to all generated nodes where possible; useful for JaCoCo (which has built in support),
or other style checkers and code coverage tools:
-
lombok.addLombokGeneratedAnnotation = true
- lombok.addLombokGeneratedAnnotation = true
Lombok can add the @SuppressFBWarnings annotation which is useful if you want to run FindBugs on your class files. To enable this feature, make sure findbugs is on the classpath when you compile, and add the following config key:
-
lombok.extern.findbugs.addSuppressFBWarnings = true
- lombok.extern.findbugs.addSuppressFBWarnings = true
These config keys can make lombok affect source files even if they have 0 lombok annotations in them.
-
lombok.fieldDefaults.defaultPrivate = truelombok.fieldDefaults.defaultFinal = true
- lombok.fieldDefaults.defaultPrivate = truelombok.fieldDefaults.defaultFinal = true@FieldDefaults documentation for more.
@f.featureSection>
@@ -117,19 +117,19 @@
<@f.main.h3 title="Importing the configuration from a different file" />
At the top of a configuration file it is possible to import other configuration files. Imported files don't have to be called lombok.config and can have any file extension (or even none).
-
import ../configuration/model.config
- import ../configuration/model.config
For shared projects, it makes sense to always use relative paths. For individuals, it is also possible to use absolute paths.
-
# Linuximport /etc/lombok/model.config# Windowsimport d:/lombok/model.config
- # Linuximport /etc/lombok/model.config# Windowsimport d:/lombok/model.configConfiguration files can import multiple configuration files as long as they are specified before any configuration key. @@ -142,23 +142,23 @@
It is also possible to import files from .jar and .zip files.
-
# Use 'lombok.config' from the root of the archive.import ../deps/lombok-config.jar# Use a given file in the archive.import ../deps/lombok-config.zip!base/model.config
- # Use 'lombok.config' from the root of the archive.import ../deps/lombok-config.jar# Use a given file in the archive.import ../deps/lombok-config.zip!base/model.config
When importing files, it is possible to use environment variables.
-
# Environment variables are names surrounded by angle brackets (<, >).# They are replaced by System.getenv(name), if present.import <JAVA_PROJECTS>/shared.config# A tilde (~) at the start gets replaced by System.getProperty("user.home", "~").import ~/my.config
- # Environment variables are names surrounded by angle brackets (<, >).# They are replaced by System.getenv(name), if present.import <JAVA_PROJECTS>/shared.config# A tilde (~) at the start gets replaced by System.getProperty("user.home", "~").import ~/my.config