The Lombok compiler plugin is Experimental.
It may be dropped or changed at any time. Use it only for evaluation purposes.
We would appreciate your feedback on it in YouTrack.
{style="warning"}
The Kotlin Lombok compiler plugin allows the generation and use of Java's Lombok declarations by Kotlin code
in the same mixed Java/Kotlin module.
If you call such declarations from another module, then you don't need to use this plugin for the compilation of
that module.
The Lombok compiler plugin cannot replace Lombok, but it helps Lombok work in mixed Java/Kotlin modules.
Thus, you still need to configure Lombok as usual when using this plugin.
Learn more about how to configure the Lombok compiler plugin.
Supported annotations
The plugin supports the following annotations:
@Getter, @Setter
@Builder, @SuperBuilder
@NoArgsConstructor, @RequiredArgsConstructor, and @AllArgsConstructor
If you use a Lombok configuration filelombok.config, you need to set the file's path so that the plugin can find it.
The path must be relative to the module's directory.
For example, add the following code to your build.gradle(.kts) file:
To use the Lombok compiler plugin, add the plugin lombok to the compilerPlugins section and the dependency
kotlin-maven-lombok to the dependencies section.
If you use a Lombok configuration filelombok.config,
provide a path to it to the plugin in the pluginOptions. Add the following lines to the pom.xml file:
By default, the kapt compiler plugin runs all annotation processors and disables annotation processing by javac.
To run Lombok along with kapt, set up kapt to keep javac's annotation processors working.
If you use Gradle, add the option to the build.gradle(.kts) file:
kapt {
keepJavacAnnotationProcessors = true
}
In Maven, use the following settings to launch Lombok with Java's compiler:
Lombok compiler plugin JAR is available in the binary distribution of the Kotlin compiler. You can attach the plugin
by providing the path to its JAR file using the Xplugin kotlinc option: