【问题标题】:Intellij idea Compilation Error with Project Lombok in JDK-16Intellij idea JDK-16 中 Project Lombok 的编译错误
【发布时间】:2021-06-24 09:59:07
【问题描述】:
<build>
        <plugins>
            <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>

            <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>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings>
                    <fork>true</fork>
                    <compilerargs>
                        <arg>-Werror</arg>
                        <arg>-Xlint:all</arg>
                        <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
                        <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
                        <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
                        <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
                        <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
                        <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
                        <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
                        <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
                        <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
                    </compilerargs>
                </configuration>
            </plugin>
        </plugins>
    </build>

这是我在 pom.xml 文件中的构建标签。但是当运行 spring boot 项目时,我有异常。 我正在使用 JDK-16 版本。在我的 intellij 想法中,将项目 lombok 安装为插件。我有项目 lombok 依赖项。错误是;

java: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x48904e01) 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 @0x48904e01`

【问题讨论】:

  • 您好,这个问题可以联系github.com/rzwitserloot/lombok/issues/2681
  • 谢谢你的回答...不过我试试看..
  • 没有人应该使用以 com.sun 开头的软件包。
  • 好的。我是春季靴子的新手。我能做些什么。???我的春季项目开始了,“com.fsk”。我不知道 com.sun )):
  • 使用com.sun的不是你的项目,是Lombok。

标签: java spring-boot pom.xml lombok


【解决方案1】:

请确保您使用的是最新的龙目岛版本。然后删除项目根目录中的 .iml 文件,然后进行构建应该可以解决此问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-10
    • 2014-06-22
    • 2019-12-07
    • 1970-01-01
    • 1970-01-01
    • 2018-09-07
    • 2014-07-23
    • 1970-01-01
    相关资源
    最近更新 更多