Idea中使用Lombok 編譯報找不到符號


1、問題描述

項目中使用了lombok,但是在idea編譯過程是出現找不到符號。報錯如下圖所示:


 
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版本如下:

<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.8</version> <scope>provided</scope> </dependency> 

idea的lombok插件版本為:


 
file

2、網上看到的3種解決方式

2.1 第一種(無效)

 
file

2.2 第二種(無效)

 
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!




原文鏈接:https://www.jianshu.com/p/f86e1e26099b


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM