1、问题描述
项目中使用了lombok,但是在idea编译过程是出现找不到符号。报错如下图所示:
@Data
@ApiModel(value = "HeadTeacherVO", description = "设置班主任对象")
public class HeadTeacherVO implements Serializable {
private static final long serialVersionUID = 5156410770039160995L;
@NotNull(message = "年级班级ID不能为空")
@ApiModelProperty(value = "年级班级ID", example = "1")
private Long gradeClassId;
@NotNull(message = "教师ID不能为空")
@ApiModelProperty(value = "教师ID", example = "1")
private Long teacherId;
}
lombok版本如下:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
<scope>provided</scope>
</dependency>
idea的lombok插件版本为:
2、网上看到的3种解决方式
2.1 第一种(无效)
2.2 第二种(无效)
2.3 第三种(有效)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArguments>
<extdirs>src\main\webapp\WEB-INF\lib</extdirs>
</compilerArguments>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
在编译,OK!