I added a Lombok dependency in my pom.xml file:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
</dependency>
After Lombok library appeared in corresponding .m2 subfolder, I clicked on it, chose STS location and installed, without errors.
A new file named lombok was added to STS root folder and I was able to update/install my application using standard Maven commands.
Anyway, STS keeps on underlining setters/getters and constructors of classes where Lombok is used, as if it were not able to find those methods.
Following some posts even here on Stackoverflow, I removed the PROVIDED scope from dependency and modified my .ini file as in the following:
-startup
plugins/org.eclipse.equinox.launcher_1.6.600.v20231106-1826.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.800.v20231003-1442
-product
org.springframework.boot.ide.branding.sts4
--launcher.defaultAction
openFile
-vm
plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.10.v20240120-1143/jre/bin
-vmargs
-javaagent:C:UsersbiagiDownloadssts-4.21.1.RELEASElombok.jar
-Xbootclasspath/a:C:UsersbiagiDownloadssts-4.21.1.RELEASElombok.jar
--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED
--add-opens=java.base/sun.security.ssl=ALL-UNNAMED
-Dosgi.requiredJavaVersion=17
-Dosgi.dataAreaRequiresExplicitInit=true
-Dorg.slf4j.simpleLogger.defaultLogLevel=off
-Dsun.java.command=SpringToolSuite4
-Dp2.trustedAuthorities=https://download.eclipse.org,https://archive.eclipse.org,https://cdn.spring.io
-Xms256m
-Xmx2048m
--illegal-access=permit
--add-modules=ALL-SYSTEM
Anyway, this didn’t change a thing. Even if I can compile correctly, this problem could be bothersome in the future, since IDE may hide real errors among red lines.
Can anyone help?
Thanks in advance.
2
Have you configured lombok as an annotation processor?
<plugins>
<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>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
Also, the dependency should have scope=provided
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependencies>