一、build.gradle
dependencies {
// src/main
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
// src/test
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
}
注意:如果不添加 testAnnotationProcessor 'org.projectlombok:lombok',那么单元测试编译过程中会报错👇
error: cannot find symbol
log.info("hello");
^
symbol: variable log
二、下载 Lombok Plugin
三、Enable annotation processing
Preferences -> Build, Execution, Deployment -> Compiler -> Annotation Processors