一、問題描述
項目中使用了lombok,可是在idea編譯過程是出現找不到符號。報錯以下圖所示:java
![](http://static.javashuo.com/static/loading.gif)
file
@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版本以下:web
<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.8</version> <scope>provided</scope> </dependency>
idea的lombok插件版本爲:apache
![](http://static.javashuo.com/static/loading.gif)
file
二、網上看到的3種解決方式
2.1 第一種(無效)
![](http://static.javashuo.com/static/loading.gif)
file
2.2 第二種(無效)
![](http://static.javashuo.com/static/loading.gif)
file
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!app
原文連接:https://www.jianshu.com/p/f86e1e26099b
webapp