micronaut-projects / micronaut-gradle-plugin

A Gradle Plugin for Micronaut
Apache License 2.0
66 stars 43 forks source link

Micronaut Plugin fails to detect Lombok Plugin #230

Open guillermocalvo opened 3 years ago

guillermocalvo commented 3 years ago

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

Example Application

stmty9 commented 1 year ago

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