Java and Lombok and Eclipse

JavaandLombokandEclipse

DownloadtheLombokfromhere,theversionis1.18.6ormecurrently

https://projectlombok.org/download

>wgethttps://projectlombok.org/downloads/lombok.jar

GotofindmyEclipseDirectory/Applications/Eclipse.app/Contents/MacOS

Placethejarpackagethere

>cp/Users/hluo/Downloads/lombok.jar/Applications/Eclipse.app/Contents/MacOS/

Gothetheconfigurationfile

>cd/Applications/Eclipse.app/Contents/Eclipse

>vieclipse.ini

-javaagent:lombok.jar

RestartmyEclipse

Enabletheannotationprocessing,Eclipse—>SelecttheProject—>Properties—>JavaCompiler—>AnnotationProcessing

Enableprojectspecificsettings,keepothersindefaultvalues.

ApplyandasktheProjecttobuildnow.

Notworkingforme,sofollowingthislinkhttps://projectlombok.org/setup/eclipse

OpenthejarIdownload

Ifoundthisisaddedtotheendofeclipse.ini

-javaagent:/Applications/Eclipse.app/Contents/Eclipse/lombok.jar

-vmargs-javaagent:/Applications/Eclipse.app/Contents/Eclipse/lombok.jar

Itjustdoesnotworkmylatesteclipse,trywithotherIDE

https://projectlombok.org/setup/intellij

IntelliJ—>References—>Plugins—>Searchfor‘LombokPlugin’

Installthatplugin-RestartIntelliJ-Itworkswell.

ShortcutforIntelliJ

https://www.jetbrains.com/help/idea/mastering-keyboard-shortcuts.html

Command+Otofindtheclassandfile

Somedetailsaboutlombok

https://www.jianshu.com/p/2ea9ff98f7d6

TrySpringToolSuiteonMAC

Downloadthetoolfromherehttps://spring.io/tools

ItworksprettywellonSTS.Iinstalledthejarmanuallyandthenaddtheseintheend

-javaagent:/Applications/Eclipse.app/Contents/Eclipse/lombok.jar

Addthistopom.xmlinmySpringBootMavenProject

<dependency>

<groupId>org.projectlombok</groupId>

<artifactId>lombok</artifactId>

</dependency>

ForPOJO,@Setterand@Getterwillgeneratethegettersettermethodsforme.

@Slf4jforaddloginmyControllerorServiceClass.

References:

https://www.jianshu.com/p/2ea9ff98f7d6

https://nawaman.net/blog/2017-11-05

https://stackoverflow.com/questions/42366374/lombok-log-and-slf4j-not-have-error-method

相关推荐