micronaut-gradle-plugin icon indicating copy to clipboard operation
micronaut-gradle-plugin copied to clipboard

Micronaut Plugin fails to detect Lombok Plugin

Open guillermocalvo opened this issue 3 years ago • 1 comments

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

guillermocalvo avatar Jul 16 '21 10:07 guillermocalvo

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

stmty9 avatar Sep 30 '22 18:09 stmty9