[Error] IntelliJ SpringBoot Class 파일 인식 안됨 package ... does not exist

YUNU·2023년 11월 22일
0

TROUBLESHOOTING

목록 보기
1/4
post-thumbnail

🟦 error: package ... does not exist

- Error Message

error: package server.healthyFriends.domain.entity does not exist
import server.healthyFriends.domain.entity.Objective;

domain 패키지 내의 엔티티들을 entity 패키지에 이동시켰더니
IntelliJ가 Class 파일들을 인식하지 못하는 문제가 발생하였다.

import 경로에는 문제가 없어 다음 순서로 문제 해결을 시도하였다.

🟦 해결 과정

1. 프로젝트 새로고침

Gradle 창에서 Refresh

➡️ 해결 안됨


2 Reimport 프로젝트
Invalidate Caches / Restart

-> Invalidate and Restart

-> IntelliJ IDEA 재시작

➡️ 해결 안됨


3. .idea 패키지 삭제 후 재시작

➡️ 해결 안됨


4. 패키지 구조 이전 상태로 복구
entity 패키지에서 엔티티 클래스들을 밖으로 빼냄

-> 새로운 에러 발생

- Error Message

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource 

domain.BodycompositionRecord와 domain.entity.BodycompositionRecord 클래스가
동일한 JPA 엔터티 이름 BodycompositionRecord를 공유하고 있어서 발생

entity.BodycompositionRecord는 없는데...


캐시 문제라 생각하여 다시 2번 수행 ➡️ 해결 안됨

🟦 해결

터미널에 다음과 같은 명령어 입력

./gradlew clean build

해결 완료!

profile
DDeo99

0개의 댓글