Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delombok fails on JDK 17 #98

Open
michalkochanowicz opened this issue Jan 12, 2022 · 5 comments
Open

Delombok fails on JDK 17 #98

michalkochanowicz opened this issue Jan 12, 2022 · 5 comments

Comments

@michalkochanowicz
Copy link

When running on Adoptium JDK 17.0.1.12 delombok task fails with such an error:

[ERROR] Failed to execute goal org.projectlombok:lombok-maven-plugin:1.18.20.0:delombok (default) on project xxx-yyy-war: Unable to delombok: InvocationTargetException: Cannot read field "bindingsWhenTrue" because "currentBindings" is null -> [Help 1]

Lombok 1.18.20 has similar issue, but it is solved in Lombok 1.18.22+.

Command used:

mvn clean install javadoc:javadoc

Plugin setup:

<plugin>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok-maven-plugin</artifactId>
    <version>1.18.20.0</version>
    <configuration>
        <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
        <outputDirectory>${project.build.directory}/generated-sources/delombok</outputDirectory>
        <addOutputDirectory>false</addOutputDirectory>
    </configuration>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>delombok</goal>
            </goals>
        </execution>
    </executions>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <configuration>
        <sourcepath>${project.build.directory}/generated-sources/delombok</sourcepath>
    </configuration>
</plugin>
@straumat
Copy link

Same here. I also have the error with lombok-maven-plugin:1.18.20.1-SNAPSHOT

@awhitford
Copy link
Owner

projectlombok/lombok#3025 is holding back the upgrade to Lombok 1.18.22.

You can try overriding the Lombok version, as described here.

@straumat
Copy link

straumat commented Feb 6, 2022

sleberknight added a commit to kiwiproject/kiwi-parent that referenced this issue Aug 7, 2023
When trying to release kiwi, received error:

Unable to delombok: InvocationTargetException: Cannot read field
"bindingsWhenTrue" because "currentBindings" is null

This is a known error. For more details, see
awhitford/lombok.maven#98
sleberknight added a commit to kiwiproject/kiwi-parent that referenced this issue Aug 7, 2023
When trying to release kiwi, received error:

Unable to delombok: InvocationTargetException: Cannot read field
"bindingsWhenTrue" because "currentBindings" is null

This is a known error. For more details, see
awhitford/lombok.maven#98
@ejep520
Copy link

ejep520 commented Jan 19, 2024

I saw this in a very early draft of a project I'm working on for a class.

import org.springframework.data.annotation.Id;
                                          ^
  bad class file: <munge>\.m2\repository\org\springframework\data\spring-data-commons\3.2.1\spring-data-commons-3.2.1.jar(org/springframework/data/annotation/Id.class)
    class file has wrong version 61.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.888 s
[INFO] Finished at: 2024-01-19T14:23:37-08:00
[ERROR] Failed to execute goal org.projectlombok:lombok-maven-plugin:1.18.20.0:delombok (default-cli) on project bean-582-2024: Unable to delombok: InvocationTargetException: Abort -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Based on my read of the error, I was able to sidestep the issue by removing all references to org.springframework.* (which I can still do at this very early stage). Spring Initializer no longer allows Java 8 as an option, and using the CompilerVersion/source/target configuration workaround from the website doesn't seem to be an option in Maven anymore.

Since this ultimately comes back to being a Java 9+ problem, it seemed apropos to post here. Please reach out of you need more. GL!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@awhitford @straumat @ejep520 @michalkochanowicz and others