maven打包报错:cannot access class com.sun.tools.javac.processing
class lombok.javac.apt.LombokProcessor (in unnamed module @0x61bfc9bf) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compile
·
将项目打包时,控制台报错,信息如下:
class lombok.javac.apt.LombokProcessor (in unnamed module @0x61bfc9bf) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x61bfc9bf
这是lombok版本过低导致,报错版本pom依赖:
<!--Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.16</version>
</dependency>
将1.18.16改为1.18.24改为高版本:
<!--Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</dependency>
再次打包,成功:
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ zhufeng-base-api ---
[INFO] Building jar: /Users/zhufeng/workplace/zhufeng-base-api-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ zhufeng-base-api ---
[INFO] Installing /Users/zhufeng/workplace/zhufeng-base-api-1.0-SNAPSHOT.jar
[INFO] Installing /Users/zhufeng/workplace/zhufeng-base-api-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.261 s
[INFO] Finished at: 2022-08-30T10:28:44+08:00
[INFO] ------------------------------------------------------------------------
有时候pom中没有没指定lombok版本,使用默认版本时也需要注意检查默认的版本号
更多推荐
已为社区贡献1条内容
所有评论(0)