micronaut-gradle-plugin
micronaut-gradle-plugin copied to clipboard
Micronaut Plugin fails to detect Lombok Plugin
Related to: #40
MicronautApplicationPlugin
does not support Lombok when it's added through the Lombok Gradle Plugin (which is recommended by the official website):
Steps to Reproduce
plugins {
...
id("io.freefair.lombok") version "6.0.0-m2"
}
For example, when a bean constructor is replaced with @RequiredArgsConstructor
then Micronaut fails to instantiate it.
Stacktrace
BeanInstantiationException: Error instantiating bean of type [X]: X: method 'void <init>()' not found
Possible Workaround
Replace Lombok Gradle Plugin with plain old dependencies:
dependencies {
...
annotationProcessor("org.projectlombok:lombok")
compileOnly("org.projectlombok:lombok")
}
However, it would be nice if the Lombok Gradle Plugin could be used in conjunction with Micronaut.
Environment Information
- Operating System: Windows 10
- Micronaut Version: 2.5.8
- JDK Version: openjdk version "11.0.11" 2021-04-20
Example Application
- https://github.com/guillermocalvo/micronaut-gradle-plugin-issue
Have you tested your "possible" workaround?
I have had success using the pattern you're describing with @RequiredArgsConstructor
in spring, and was hoping to get it to work with micronaut too. Looking at my compiled classes, it looks like it should work.
Micronaut: 3.6.3 Lombok: 1.18.24 java: 17