Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij does not recognize lombok.config when building

I opened the restbucks project with Intellij. I have lombok plugin installed, annotation processing enabled. I am using javac compiler in Intellij settings. I have lombok.config in project root like in git repository, I also tried copying it to src/main/java and src/main/resources but no matter what I try, when I build the project with Intellij, after posting an order, I get:

Argument #0 of constructor [constructor for org.springsource.restbucks.order.Order, annotations: {interface com.fasterxml.jackson.annotation.JsonCreator=@com.fasterxml.jackson.annotation.JsonCreator(mode=DEFAULT)}] has no property name annotation; must have name when multiple-parameter constructor annotated as Creator

Seems like lombok.anyConstructor.suppressConstructorProperties=true has no effect. When I build with maven then it works fine. When I delete the lombok.config file, Intellij starts showing errors all over the project so the file seems to be recognized by Intellij afterall. But the build doesn't run as expected as posting to orders fails as mentioned above. Does anyone know what's going on here?

like image 373
aycanadal Avatar asked Nov 13 '17 09:11

aycanadal


People also ask

How to install Lombok in IntelliJ IDEA?

So you have to install the lombok plugin, that's all! In MacBook press command+, and then go to plug-in and search for Lombok and then install it. It will work without restarting IntelliJ IDEA IDE if doesn't work then please try with restart.

Can Lombok be used on standard Java code?

A comprehensive and very practical introduction to many useful usecases of Project Lombok on standard Java code. 2. Lombok in IntelliJ IDEA As of IntelliJ version 2020.3, we don't need to configure the IDE to use Lombok anymore.

How to fix Lombok not working after upgrade to 2018 idea?

Same here, it didn't work after the upgrade to 2018 IDEA. You don't have to reinstall the plugin though. Just go to Settings > Plugins, open the Updates tab, and you should see an update for Lombok. After Lombok's update and another restart of Intellij, it should work. Just disabling, and then re-enabling and restarting worked for me.

Why is my Lombok plugin not recognised by Android Studio?

It's possible that you already have the Lombok plugin, and still the generated methods are not recognised by Android Studio. In such case the plugin might be out of date, so the solution is to simply update it. Preferences -> Plugins -> Lombok Plugin -> Update Plugin


1 Answers

Lombok plugin does support lombok.config file.

The lombok.anyConstructor.suppressConstructorProperties is deprecated as per in Lombok doc

BREAKING CHANGE: lombok config key lombok.anyConstructor.suppressConstructorProperties is now deprecated and defaults to true, that is, by default lombok no longer automatically generates @ConstructorProperties annotations. New config key lombok.anyConstructor.addConstructorProperties now exist; set it to true if you want the old behavior. Oracle more or less broke this annotation with the release of JDK9, necessitating this breaking change.

Use the new lombok.anyConstructor.addConstructorProperties in the lombok.config located in the root folder and also, perform a clean install and then should be fine.

like image 187
Flávio Henrique Avatar answered Sep 23 '22 20:09

Flávio Henrique