Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to delombok: InvocationTargetException

Tags:

maven

lombok

Unable to delombok: InvocationTargetException: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid' (this is the error on terminal)

I am building code but getting this error on running "mvn clean install" I was using jdk 21 before but now I shifted to jdk 17 (since some posts online were saying it's incompatible with 21) but I am still getting the same error, "lombok:1.18.20.0:delombok (default)" this is show on the terminal followed by BUILD FAILURE, help to build the code would be really appreciated as I have been stuck on this error for a long time now.

Thanking in advance

like image 953
user23391589 Avatar asked Nov 04 '25 08:11

user23391589


1 Answers

It seems you are using the lombok-maven-plugin to perform the delombok task during a Maven build. That is a third-party plugin not maintained by the lombok team, and it has not been updated for several lombok versions. The latest plugin version 1.18.20.0 uses lombok 1.18.20, which does not work for JDK 17 or JDK 21.

However, you can easily instruct lombok-maven-plugin to use a newer lombok version via pom.xml:

    <build>
        <plugins>
            <plugin>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok-maven-plugin</artifactId>
                <version>1.18.20.0</version>
                <dependencies>
                    <dependency>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                        <version>1.18.30</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
like image 61
Jan Rieke Avatar answered Nov 07 '25 08:11

Jan Rieke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!