From 0f31c62806f000516f4cdef1bfa87cf22c362130 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Sat, 18 Jan 2020 01:59:02 +0100 Subject: Config import: add documentation --- website/templates/features/configuration.html | 54 ++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) (limited to 'website/templates/features/configuration.html') diff --git a/website/templates/features/configuration.html b/website/templates/features/configuration.html index bf224108..82b93549 100644 --- a/website/templates/features/configuration.html +++ b/website/templates/features/configuration.html @@ -2,7 +2,8 @@ <@f.scaffold title="Configuration system" logline="Lombok, made to order: Configure lombok features in one place for your entire project or even your workspace."> <@f.history> - The configuration system was introduced in lombok 1.14. + The configuration system was introduced in lombok 1.14.
+ The import directive was added in lombok 1.18.12. <@f.overview> @@ -111,4 +112,55 @@ Turning either of these options on means lombok will make every field in every source file final and/or private unless it has an explicit access modifier or annotation to suppress this. See the @FieldDefaults documentation for more.

+ + <@f.featureSection> + <@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 +
+ The location of an imported file is resolved relative to the file that imports it. +

+

+ For shared projects, it makes sense to always use relative paths. For individuals, it is also possible to use absolute paths.
+

+ # Linux
+ import /etc/lombok/model.config
+ # Windows
+ import d:/lombok/model.config +
+

+

+ Configuration files can import multiple configuration files as long as they are specified before any configuration key. + The system behaves as if the contents of the imported file is at the location of the import declaration. +

+

+ The way the configuration system works is that duplicate entries are effectively ignored. It is a last-wins. Lombok will only + process a configuration file once when resolving a specific value. This allows you to import the same files from different + configuration files, and even create loops without any problems. +

+

+ 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 +
+ Configuration files inside archives can import other configuration files, provided that they are in the same archive. +

+

+ 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 +
+ As with absolute paths, this is more useful for individuals than for shared projects. +

+ + -- cgit