编译插件时:maven 报错
Posted
技术标签:
【中文标题】编译插件时:maven 报错【英文标题】:When compiling plugins:maven throws an error 【发布时间】:2021-11-27 10:50:20 【问题描述】:编译插件时:maven抛出错误
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project user-lib: Fatal error compiling: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x2a9f8d47) 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 @0x2a9f8d47 -> [Help 1]
pom.xml
<properties>
<java.version>17</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<spring-boot-starter-test.version>2.3.2.RELEASE</spring-boot-starter-test.version>
<junit-version>5.7.0</junit-version>
<spring.version>5.2.8.RELEASE</spring.version>
<lombok.version>1.18.12</lombok.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>$junit-version</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>$spring.version</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>$spring-boot-starter-test.version</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>$lombok.version</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>$maven-compiler-plugin.version</version>
<configuration>
<source>$maven.compiler.source</source>
<target>$maven.compiler.target</target>
</configuration>
</plugin>
</plugins>
</build>
在 Java 11 版本上一切正常。 现在我正在尝试升级到 Java 版本 17。立即出现了这样的错误。 我不明白这个错误与什么有关。龙目岛和它有什么关系?
【问题讨论】:
【参考方案1】:问题出在lombok版本中 https://github.com/projectlombok/lombok/issues/2681 安装了lombok 1.8.22版本,错误消失了。
【讨论】:
以上是关于编译插件时:maven 报错的主要内容,如果未能解决你的问题,请参考以下文章
简单的centos7访问server12r2共享竟然报错报错报错~~~~~~~