我遇到一个问题
我用

IntelliJ IDEA 2017.3.1
Build #IU-173.3942.27, built on December 11, 2017
JRE: 1.8.0_111-b14 amd64
JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation
Windows 7 6.1



  错误:(16、10)Java:无法解析日志


import lombok.extern.slf4j.Slf4j;
import org.junit.Test;


@Slf4j
public class LogTest {

    @Test
    public void testSlf4j(){
         log.info("测试 lombok slf4j logback");
    }

}


我有配置
设置->构建,执行,部署->编译器->注释启用注释处理

设置->其他设置->龙目岛

    <!-- SLF4J -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.21</version>
    </dependency>
    <!-- Logback -->
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-core</artifactId>
        <version>1.1.3</version>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.1.3</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>log4j-over-slf4j</artifactId>
        <version>1.7.21</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.16.20</version>
    </dependency>

最佳答案

可能您必须安装Lombok Plugin,以便IDEA知道该注释的含义。

10-07 15:23