-
[Tnote] error: variable userRepository not initialized in the default constructorT-note 2024. 2. 15. 10:05728x90
문제 상황
프로젝트 clean- build 진행시 해당 에러 발생하면서 build 실패
error: variable userRepository not initialized in the default constructor
발생 원인
찾아본 바로는 먼저 lombok의 오류이다.
gradle 버전에 따른 lombok 버전 오류인데, 나같은 경우는 잘 되어 있다.
Gradle 5.x 미만
dependencies { implementation 'org.projectlombok:lombok' }
Gradle 5.x 이상
dependencies { compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' }
나의 경우도 결국 찾아보니까 lombok이긴 한데, 나는 test file(testSyUtil 파일)에서 에러가 났었어서 test와 관련된 lombok 코드를 gradle에 넣어줘야 했다
해결 방법
test 관련해서 아래와 같은 코드를 추가했더니 빌드를 성공하였다
testAnnotationProcessor 'org.projectlombok:lombok' //추가
결과 화면
빌드 성공 'T-note' 카테고리의 다른 글
[error] Error creating bean with name 'jwtTokenProvider': Injection of autowired dependencies failed (0) 2024.02.16 [code deploy] code deploy중 access denied (2) 2024.02.16 [error] build 오류 (0) 2024.02.10 [error] Name for argument of type [java.lang.Long] not specified (0) 2024.01.09 [Tnote] 스프링 시큐리티 - @AuthenticationPrincipal 로그인 정보 받기 (0) 2023.12.30