问题:可以正常引用,而且也有提示,但是就是没有效果出来

首先按照网上的教程设置了这个地方发现还是没用,而且之前手动引入依赖都不用的,但是设置总之没错

最后发现:是POM.xml自动生成的配置文件的时候,出现问题
移除optional
属性
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
optional
属性表明该依赖不会被传递到依赖的模块中。- 如果你只在当前模块使用 Lombok就保留;
- 但如果 Lombok 的注解被多个模块引用,就移除
optional
。
所以我移除了
Spring Boot Maven 插件中配置了 Lombok 的排除
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
PS:我也不知道这个排除是什么东西,反正就是用可能会冲突(不就是这些东西搞得我用不了的)
所以我们也删掉这一段
指定版本号
修改这两个地方的版本号
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
<!-- <optional>true</optional>-->
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
然后点击这个

重启

最后测试成功ヾ(≧▽≦*)oヾ(≧▽≦*)oヾ(≧▽≦*)o
