Lombok annotations do not compile under Intellij idea [duplicate]
- I've installed the plugin for intellij idea(lombok-plugin-0.8.6-13).
- Added lombok.jar into classpath
- I can find getters and setters in the window of structure. And Intellij shows no error.
- Setting - Lombok plugin - Verified Intellij configuration for lombok, it shows that "configuration of IntelliJ seems to be ok".
It seems everything is OK. But when I compile a test, errors come: can not find the methods getXXX and setXXX.
I opened the .class file with IntelliJ and find out that there is no setXXX and getXXX methods.
Could somebody tell me why?
- plugin:lombok-plugin-0.8.6-13
- lombok.jar:1.14.0
- idea:13.0.2 for linux
- jdk:1.7.0_21
In order to solve the problem set:
- Preferences (Ctrl + Alt + S)
- Build, Execution, Deployment
- Compiler
- Annotation Processors
- Enable annotation processing
- Annotation Processors
- Compiler
- Build, Execution, Deployment
Make sure you have the Lombok plugin for IntelliJ installed!
- Preferences
->
Plugins - Search for "Lombok Plugin"
- Click Browse repositories...
- Choose Lombok Plugin
- Install
- Restart IntelliJ
If you're using Eclipse compiler with lombok, this setup finally worked for me:
- IDEA 14.1
- Lombok plugin
- ... / Compiler / Java Compiler > Use Compiler: Eclipse
- ... / Compiler / Annotation Processors > Enable annotation processing: checked (default configuration)
- ... / Compiler > Additional build process VM options:(Shared build process VM options) -javaagent:lombok.jar
The most important part is the last one, mine looks like following:
Plugin is needed for IntelliJ editor to recognize getters and setters, javaagent is needed for eclipse compiler to compile with lombok.
If you're using Intellij on Mac, this setup finally worked for me.
Installations: Intellij
- Go to Preferences, search for Plugins.
- Type "Lombok" in the plugin search box. Lombok is a non-bundled plugin, so it won't show at first.
- Click "Browse" to search for non-bundled plugins
- The "Lombok Plugin" should show up. Select it.
- Click the green "Install" button.
- Click the "Restart Intellij IDEA" button.
Settings:
-
Enable Annotation processor
- Go to Preferences -> Build, Execution,Deployment -->Preferences -> Compiler -> Annotation Processors
- File -> Other Settings -> Default Settings -> Compiler -> Annotation Processors
-
Check if Lombok plugin is enabled
- IntelliJ IDEA-> Preferences -> Other Settings -> Lombok plugin -> Enable Lombok
-
Add Lombok jar in Global Libraries and project dependencies.
- File --> Project Structure --> Global libraries (Add lombok.jar)
File --> Project Structure --> Project Settings --> Modules --> Dependencies Tab = check lombok
Restart Intellij