0

I've installed the Lombok using java -jar lombok-1.18.14.jar getting successful message into Eclipse 2020-09 (4.17) but it's not appearing in About window.

pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>redact</groupId>
    <artifactId>redact</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.plugin>3.5.1</maven.compiler.plugin>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <springFramework>5.2.9.RELEASE</springFramework>
        <springSecurity>5.4.1</springSecurity>
        <thymeleaf>3.0.11.RELEASE</thymeleaf>
        <thymeleafSecurity>3.0.4.RELEASE</thymeleafSecurity>
        <mysql>8.0.21</mysql>
        <logback>1.2.3</logback>
        <slf4j>1.7.30</slf4j>
        <mapStruct>1.4.0.Final</mapStruct>
        <lombok>1.18.14</lombok>
    </properties>

    <dependencies>
        <!-- Servlet API Dependency -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
        </dependency>

        <!-- Spring Framework Dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${springFramework}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${springFramework}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${springFramework}</version>
        </dependency>

        <!-- Spring Data Dependencies -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>2.3.4.RELEASE</version>
        </dependency>

        <!-- Spring Security Dependencies -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${springSecurity}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${springSecurity}</version>
        </dependency>

        <!-- Spring JDBC dependency -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${springFramework}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/javax.persistence/javax.persistence-api -->
        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>javax.persistence-api</artifactId>
            <version>2.2</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>6.0.13.Final</version>
        </dependency>

        <!-- Mysql connector dependency -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql}</version>
        </dependency>

        <!-- JSTL Dependency -->
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- Thymeleaf -->
        <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf</artifactId>
            <version>${thymeleaf}</version>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf-spring5</artifactId>
            <version>${thymeleaf}</version>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
            <version>${thymeleafSecurity}</version>
        </dependency>

        <!-- Logback -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback}</version>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok-mapstruct-binding</artifactId>
            <version>0.1.0</version>
        </dependency>

        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
            <version>${mapStruct}</version>
        </dependency>

        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-processor</artifactId>
            <version>${mapStruct}</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>5.4.22.Final</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin}</version>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok}</version>
                        </path>
                        <path>
                            <groupId>org.mapstruct</groupId>
                            <artifactId>mapstruct-processor</artifactId>
                            <version>${mapStruct}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

eclipse.ini:

-startup
plugins/org.eclipse.equinox.launcher_1.5.800.v20200727-1323.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1300.v20200819-0940
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs -javaagent:D:\dev\eclipse\lombok.jar -Xbootclasspath/a:D:\dev\eclipse\lombok.jar
-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-javaagent:D:\dev\eclipse\lombok.jar

Originally, when I installed Lombok, only the last -javaagent was included. As soon as I opened the Eclipse, the lombok/launch/PatchFixesHider$Transform error happened (as explained here).

I tried to install again and saw an information from the installer about the -vm and -vmargs. It says that if there is a custom -vm parameter, it's needed to put -vmargs -javaaggent:lombok.jar (all together) as well. There is no -vm at my .ini file, but I changed it anyway file to include the -javaagent after -vmargs as instructed to test. The Patch error stopped, but the install still didn't work.

I tried all possibilities with the -javaagent parameter and the Patch error only stopped if I put the parameter at same line as -vmargs.

If I remove the last line -javaagent or the -Xbootclasspath tag, nothing changes.

I tried installing Lombok versions 1.18.8 to 1.18.14 and Eclipse Photon, 2020-06 and 2020-09 (all possible combinations) and none worked.

When I put e.g. user.getPassword(), I get an error from Eclipse (method not defined), but Maven can build and install correctly (by bash or by Eclipse run as Maven)

I'm using MapStruct and the generated-sources is being created correctly for them.

Something I realized doing my testing: Sometimes I'm running the maven clean and install using bash because it's faster and the generated-sources are being created for MapStruct, but not for Lombok. So, I'm having the same problem as Eclipse. So, would be the problem with Eclipse or with Maven? Would the Lombok sources be created using a pure mvn install?

Versions:

  • jdk1.8.0_172
  • jdk-11.0.8 (only installed to use Eclipse 2020-09)
  • Lombok 1.18.8/10/12/14 (tried all versions)
  • Eclipse Photon/2020-06/2020-09 (tried all these versions)
  • `-vmargs`, `-javaagent...` and `-Xbootclasspath...` must each be in a separate line. – howlger Oct 11 '20 at 15:29
  • I know it should. But as I wrote, If I remove the -javaagent from -vmargs line and put in s different line, I get the lombok/launch/PatchFixesHider$Transform error. – Adriano Crespo Oct 11 '20 at 17:45
  • By putting it in one line you broke the `eclipse.ini`. All lines after the line `-vmargs` are arguments for the Java VM. Comments like you did in the last line are not allowed. Please show the unmodified `eclipse.ini` file. Why did you make these changes? Is this trial and error or did you read that somewhere? – howlger Oct 12 '20 at 06:53
  • The comments in parentheses were just to illustrate here what is each line. It's not in the real ini file. Originally by installing Lombok only the last line is included and I got the patch error. When I tried to install again, I saw there is an information from Lombok installation to include the parameter after-vmargs and it was what I did. The patch error stopped, but the installation didn't work. – Adriano Crespo Oct 12 '20 at 07:18
  • Sure, by changing the `-vmargs` line you disabled `-javaagent...` as VM argument. Please improve your question. IMHO adding _EDIT_ sections makes question less readable. – howlger Oct 12 '20 at 07:58
  • I've changed the question. I hope it's clearer now. I tried to include a screenshot, but I can't yet since I don't have 10 points of reputation. – Adriano Crespo Oct 12 '20 at 08:18
  • Thanks. But `-vmargs`, `-javaagent...` and `-Xbootclasspath...` must each be in a separate line. What do you get when you restore the `-vmargs` line (without anything additional in this line) and add `-Xbootclasspath...` as separate line at the end (after the line `-javaagent...`)? Please note, compiling the code via Maven using Lombok is a different thing. – howlger Oct 12 '20 at 08:42
  • I tried to have a clean eclipse install. Just to be sure it's not JDK 11, I uninstalled it. I got a fresh eclipse 2020-06 and fresh workspace. I installed the Lombok and got successful message, but no information on About screen in Eclipse. At the .ini file, -javaagent and -XbootClasspath at the end of file, separate lines. As soon as imported the project with lombok, I got the **lombok/launch/PatchFixesHider$Transform** error. The only way to stop this error is putting the -javaagent at same line as -vmargs. – Adriano Crespo Oct 12 '20 at 09:25
  • It seems you face [this issue](https://github.com/rzwitserloot/lombok/issues/2599). Does Lombok [1.18.12](https://projectlombok.org/all-versions) work? – howlger Oct 12 '20 at 09:51
  • Hey... FINALLY!!! I could make it work. I've tested before with no success. But, to be sure, this time I removed all versions of Lombok from my .m2 repository and kept only 1.18.12. Installed and worked. Thanks for your help and patience... I'll put a answer with the solution!!! Thanks a lot!!! – Adriano Crespo Oct 12 '20 at 10:07

2 Answers2

0

Lombok 1.18.14 fails to be installed in Eclipse 2020-09 (4.17.0).

As workaround for this known issue use Lombok 1.18.12 instead.

howlger
  • 31,050
  • 11
  • 59
  • 99
0

After many tries and failures, I could make it work.

This problem is related with this issue.

I've tried to install many different Lombok versions, from 1.18.8 to 1.18.14 failing all the time. To have a last test, I deleted all versions from my .m2 repository and kept only the 1.18.12 version, running the installation again and it worked.

If someone is facing this problem, my suggestion is clear all versions of Lombok from .m2 repository, delete any -javaagent referred to Lombok from eclipse.ini file and make a clean install using 1.18.12 version.

Many thanks to @howlger who helped me a lot and showed me the issue.