intelliJ java file outside of source root 해결하기

2022. 11. 3. 14:15에러문제

git에서 repository를 clone한 이후에 java source file을 intelliJ에서 열어보았는데 

빨간 글씨가 막 뜨면서 "Java file outside of source root"가 보였다.

 

그래서 stackOverflow에 이와 같은 문제를 검색해 보았는데.....

 

 

https://stackoverflow.com/questions/63521181/java-file-outside-of-source-root-intellij

 

Java file outside of source root intelliJ

I have cloned a spring boot project from GitLab having multiple branches in IntelliJ. I checkout to the branch in which I want to work. But I am getting "Java file outside of source root"...

stackoverflow.com

 

여기서 친절히 대답해주셨다.

 

일단, File 탭의 Project Structure를 열고 Modules탭에 들어간다. 

 

Mark as 탭의 Sources에 들어가 저기 있는 Content Root를 아예 다 지워버린다. 

그리고 다시 Add Content Root 버튼을 눌러 다시 파일 경로를 설정해주면 잘 된다.

'에러문제' 카테고리의 다른 글

IntelliJ에서 Gradle 인식이 안될 경우  (0) 2022.11.03