awhitford / lombok.maven

Maven Plugin for Project Lombok
http://projectlombok.org/
MIT License
110 stars 36 forks source link

No lombok-maven-plugin build for lombok 1.18.30, breaks JDK 21 delombok builds #181

Open crutcher opened 7 months ago

crutcher commented 7 months ago

Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'

See: https://stackoverflow.com/questions/77171270/compilation-error-after-upgrading-to-jdk-21-nosuchfielderror-jcimport-does-n

h-westphal commented 7 months ago

As a workaround you can specify the version of lombok to use in the plugin-section of your pom like that:

        <properties>
            <lombok.version>1.18.30</lombok.version>
            <lombok.plugin.version>1.18.20.0</lombok.plugin.version>
        </properties>
...
                <plugin>
                    <groupId>org.projectlombok</groupId>
                    <artifactId>lombok-maven-plugin</artifactId>
                    <version>${lombok.plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>delombok</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <addOutputDirectory>false</addOutputDirectory>
                        <outputDirectory>${project.build.directory}/delombok</outputDirectory>
                        <sourceDirectory>src/main/java</sourceDirectory>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>

which works for me with Java 21.

crimsonvspurple commented 4 months ago

I have similar issue.

but I get a different error. The parameters 'encoding' for goal org.projectlombok:lombok-maven-plugin:1.18.20.0:delombok are missing or invalid

            <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>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>delombok</goal>
                        </goals>
                        <configuration>
                            <encoding>UTF-8</encoding>
                            <addOutputDirectory>false</addOutputDirectory>
                            <sourceDirectory>src/main/java</sourceDirectory>
                            <outputDirectory>
                                ${project.build.directory}/delombok
                            </outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Adding/Removing the encoding tag doesn't make any difference.