使用Lombok的@ Slf4j和Intellij构建:找不到符号日志 [英] Building with Lombok's @Slf4j and Intellij: Cannot find symbol log

查看:11761
本文介绍了使用Lombok的@ Slf4j和Intellij构建:找不到符号日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个maven项目,在命令行中没有任何问题。但是,当我使用IntelliJ构建它时,我收到错误:

I have a maven project that builds with no problems from the command line. However, when I build it with IntelliJ, I get the error:

java: FileName.java:89: cannot find symbol
symbol  : variable log

java文件中没有定义或导入日志,但是是

There is no log defined or imported in the java file, but there is a

@Slf4j
final public class FileName {

语句体之前应该定义日志类的语句。

statement before the class body which should define the log class.

在项目结构窗口中,类for:

In the project structure window, classes for:

Maven: org.slf4j:jcl-over-slf4j:1.6.1
Maven: org.slf4j:slf4j-api:1.6.6
Maven: org.slf4j:slf4j-log4j12:1.6.6
Maven: org.slf4j:slf4j-simple:1.6.6

列在库下,表示已下载并可用。

are listed under libraries and are indicated as having been downloaded and available.

知道为什么这会通过命令行使用maven构建,而不是通过IntelliJ以及如何解决问题?

Any idea why this would build with maven through the command line, but not through IntelliJ and how to resolve the issue?

推荐答案

In additio如果安装了Lombok插件
(IntelliJ 12为v0.5),还要确保勾选启用注释处理复选框:
首选项 - >编译器 - >注释处理器

In addition to having Lombok plugin installed (v0.5 for IntelliJ 12), also make sure that "Enable annotation processing" checkbox is ticked under: Preferences -> Compiler -> Annotation Processors

这篇关于使用Lombok的@ Slf4j和Intellij构建:找不到符号日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆