Intellij fails to detect the logger added by @Slf4j using Lombok

我的梦境 提交于 2019-12-11 05:59:22

问题


I am writing a simple app:

@Slf4j
public class MyApp {
    public static void main(String[] argv) {
        log.info("hello world!");
    }
}

This code compiles just fine, and indeed, when run I see "hello world!" being logged out. Intellij however doesn't agree this works. I am constantly getting "Cannot resolve symbol log" even though this works and it compiles. Here's what I have done:

  1. I have installed the latest Lombok plugin
  2. I have enabled annotation processing

All other Lombok annotations seem to work fine.

I am using Intellij 2018.1 Ultimate. Is there something I'm missing here?


回答1:


Yes, this one! Either wait till lombok plugin supports Intellij 2018.1 or downgrade the IDE.

EDIT:

Above answer is outdated and issue can be fixed by following this anwer.



来源:https://stackoverflow.com/questions/49548018/intellij-fails-to-detect-the-logger-added-by-slf4j-using-lombok

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