코드 상에서는 정상적으로 어노테이션 기반으로 적용했지만 막상 build를 하거나 프로젝트를 실행할 때 아래와 같이 cannot find symbol 에러가 나는 경우 아래와 같이 세 가지 방법을 적용하면 해결할 수 있습니다.

1. File -> Setting -> Build, Execution, Deployment -> Compiler -> Annotation Processors -> Enable annotation processing

2. File -> Invalidate Caches / Restart

3. build.gradle에 아래 코드를 추가해줍니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compileOnly 'org.projectlombok:lombok' | |
annotationProcessor 'org.projectlombok:lombok' | |
testAnnotationProcessor 'org.projectlombok:lombok' | |
testCompile 'org.projectlombok:lombok' | |
testImplementation 'org.projectlombok:lombok' |
저는 3번 방법을 통해 해결했고 이 경우 Slf4j dependency가 깨지기 때문에 별도로 해결해야합니다.
- test 쪽 @Slf4j가 깨지는 것이였고 이 부분은 test 쪽 gradle을 추가하며 해결했습니다.
[참고] https://rainmaker0303.blogspot.com/2019/11/springboot-intellij-lombok.html
반응형
'[DEV] 기록' 카테고리의 다른 글
git 리포지토리에 활성 변경 내용이 너무 많습니다. 메시지가 뜰 경우 (0) | 2020.04.10 |
---|---|
npm/yarn 명령어를 통해 create-react-app 설치 시 오류가 날 경우 (0) | 2020.04.08 |
Intellij IDEA 프로젝트 분리 시 클래스 찾을 수 없는 오류 발생 시 (0) | 2020.03.03 |
공부해야하는 내용 (2) | 2020.02.28 |
KT SW 개발 합격! (8) | 2019.12.24 |