본문 바로가기

Issue

[Spring] IntelliJ에서 lombok 어노테이션이 적용되지 않는 경우

반응형

개발 환경
IntelliJ, gradle, spring-boot


오류 현상


IntelliJ에서 SpringBoot Framework를 사용한 프로젝트가 application 을 실행(Build)했을 때,

cannot find symbol 과 같은 에러가 발생할 하는 경우

해결 방법 


아래의 순서대로 해결을 하면 됩니다.

 

1 ) IntelliJ  preference →  plugin 에서 lombok 검색 lombok 플러그인 설치 

 

2 ) IntelliJ → preference → Build,Execution,Deployment → Compiler → Annotation Processors ⇢ Enable annotation processing 체크

 

3 ) IntelliJ → File → Invalidate Caches / Restart → Invalidate and Restart

 

4 ) build.gradle 파일을 다음과 같이 설정

아래의 annotionProcessor 는 Compile 수행 시 annotation 에 대한 스캔하고 롬복 관련 설정을 해주는 것이다. (Getter, Setter, Builder)

 

build.gradle

dependencies {
	…
	compileOnly 'org.projectlombok:lombok'  
	annotationProcessor 'org.projectlombok:lombok'
	…
}

 

5 ) gradle 버전을 하위 버전으로 낮춤

Gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

 

반응형

❥ CHATI Github