Building With Lombok's @Slf4j And Eclipse: Cannot Find Symbol Log
Answer :
You also have to install Lombok into Eclipse.
See also this answer on how to do that or check if Lombok is installed correctly.
Full Disclosure: I am one of the Project Lombok developers.
I got the same error even after Lombok was installed. For me the solution was to add another lombok annotation (i used @Data) to my class after which the eclipse errors went away. Perhaps this force refreshed some cache.
Of course, I simply deleted the @Data annotation afterwards.
I also faced the similar issue on log and @Slf4j on my STS environment. To resolve this, here is what I did on spring tool suite (sts-4.4.0.RELEASE) and lombok-1.18.10.jar (current latest version available in mavenrepository).
If having maven project, ensure lombok dependency added to it. Else you need manually add the jar to your project classpath.
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.10</version> <scope>provided</scope> </dependency>
Clean build the maven application. This will download lombok jar in your .m2 location by default from maven repository. The path would be
org\projectlombok\lombok\1.18.10\
Now open command prompt and navigate to the lombok path and execute command
java -jar lombok-1.18.10.jar
C:\xxx\xxx\org\projectlombok\lombok\1.18.10>java -jar lombok-1.18.10.jar
Opens up lombok dialog box. If see message
Can't find IDE
ClickSpecify location...
Provide the path to your STS root locationMy case it is
C:\apps\sts-4.4.0.RELEASE\SpringToolSuite.exe
Install/Update
Install successful Click Quit Installer
Now in explorer navigate to your STS root path.
C:\apps\sts-4.4.0.RELEASE\
We seelombok.jar
placed in the sts root path Now edit in notepadSpringToolSuite4.ini
file We see following appended at the end-javaagent:C:\apps\sts-4.4.0.RELEASE\lombok.jar
Start STS using
SpringToolSuite4.exe
Clean, rebuild your project.
Comments
Post a Comment