Intellij 14 + lombok: @Slf4j Cannot find symbol log

半腔热情 提交于 2019-12-11 01:33:45

问题


Intellij doesn't recognize @SLF4J annotation. I have the following error:

Error:(105, 9) java: cannot find symbol
symbol:   variable log
location: class com.xxxxx.SdsConfig

knowing that I have already Enable annotation processing (Settings -> Compiler -> Annotation Processors)

I use java 8 compiler.


回答1:


Use lombok plugin for Intellij:

https://plugins.jetbrains.com/plugin/6317

This will highlight everything correctly and allow you to use auto completion for generated methods.

Note that some features (like @val) are supported in Intellij 14.1 and newer.




回答2:


In Intellij version 2016, 2017, the enabling of

Preferences -> Compiler -> Annotation Processors

did not work for me.

The following additional checkbox did help:




回答3:


I had this problem when I upgraded to IntelliJ 2016.

I already had the Lombok plugin installed and Annotation Processors enabled.

I had to download a Lombok plugin from https://plugins.jetbrains.com/plugin/6317-lombok-plugin (0.15.16, as the most recent 0.15.17.2 wasn't compatible), then install it as a plugin to upgrade the installed Lombok plugin, then restart IntelliJ



来源:https://stackoverflow.com/questions/35011321/intellij-14-lombok-slf4j-cannot-find-symbol-log

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!