IntelliJ Lombok - src/integration-test classes don't see generated lombok code
Asked Answered
D

2

6

I am using IntelliJ IDEA 2016.3 + lombok plugin with the following structure:

enter image description here

Edit: this is the Module Content Root configuration:

enter image description here

Everything works as expected in src/main/java and src/test/java, but classes in src/integration-test and src/end-to-end-test don't see the generated lombok code (so no autocomplete).

I can still run the tests without any issue though.

Does anyone have any idea what I should do to benefit from auto-complete from these other test source folders?

Thanks!

Dissuasive answered 19/4, 2018 at 9:58 Comment(4)
You need to add a lombok plugin first in intellij and then in settings you need to enable it. It doesnt not work in the way in which it works in eclipse.Tuinenga
Indeed, the plugin is installed and activated (it works for src/main and src/test)Sands
I updated IntelliJ to 2018.1 (as well as the lombok plugin version) and now it worksSands
Done..Awesome..Great..!Tuinenga
R
4

You need to enable Annotation processing for your modules in IntelliJ. If you have enabled it already make sure integration-test and end-to-end-test are listed under Default.

Go to settings (Ctrl + Alt + S) ->Build Execution Deployment -->Compiler --->Annotation processors

Rosenarosenbaum answered 1/5, 2018 at 2:5 Comment(2)
Thanks for the tip! Unfortunately I can't test it anymore - as mentioned in the comments, I updated IntelliJ to 2018.1 (as well as the lombok plugin) and now it works fineSands
and make sure the checkbox "Enable annotation processing" is actually ticked for DefaultThurgau
C
1

Double check that you have enabled Lombok itself in project properties as far as processing annotations on that. Everything is in Project preferences.

Conceptionconceptual answered 19/4, 2018 at 10:2 Comment(5)
Lombok is working on src/main and src/test (methods are generated and autocomplete is working), so I guess this means it's enabled at the project level?Sands
Yes, it's on the project level but your test folders have to be added in the root content. Go to Module Settings -> Modules and take a look into right panel Content RootConceptionconceptual
I have added a screenshot of my content root - things look the same for the new folders as for the test oneSands
Sebastien, yeah. it looks ok. Only thing I can suggest is to restart IDE and/or rebuild the project from terminal with maven/gradle. It helped me sometimesConceptionconceptual
Unfortunately I did both, but to no avail. I had a look at the xml conf files generated by IntelliJ, but without much success eitherSands

© 2022 - 2024 — McMap. All rights reserved.