1. Description of the problem
The project uses lombok, but the idea is the emergence of the compilation process can not find the symbol. Given as shown below:
@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 versions are as follows:
<dependency>
<groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.8</version> <scope>provided</scope> </dependency>
lombok plug-in version of the idea is:
2, three kinds of solutions online to see
2.1 The first (invalid)
2.2 second (invalid)
2.3 The third (active)
<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!
原文链接:https://www.jianshu.com/p/f86e1e26099b