본문 바로가기
공부/java & Spring

[Spring boot build error] visual studio code에서 갑자기 빌드 에러날때

by 고기 2023. 5. 22.

오늘도 굉장히 간단하지만 일단 기록해둔다.

빌드 에러가 나는 이유는 본인이 잘못된 코드를 입력했거나 오타가 있는 등 다양하다.

근데 그런 실수가 없는데도 빌드 에러가 나는 경우가 있다. 구체적인 원인은 몰?루?겠지만 시스템적으로 꼬인 듯 싶다.

아마 협업할 때... 그러니까 프로젝트 폴더를 A컴퓨터랑 B 노트북에서 관리할 때 생길 수 있는 문제가 아닐까 생각한다.

지금 내가 그랬거든.

 

eclipse나 intellij를 사용했을때는 콘솔 명령어가 아니라 ui에서 빌드 버튼을 클릭해서 빌드시키곤 했었지만 visual studio code를 사용하면서부터는 "gradlew build" 명령어를 사용해서 빌드를 하게 되었다.

뭐... 명령어가 문제라는 건 아니고, 아무튼 평소대로 빌드를 시켰는데 갑자기 빌드를 못하겠다며 이런 메세지를 뱉었다.

PS C:\Users\nerin\Desktop\4. myproject\2. visual studio code\QR> ./gradlew build

> Task :test

MhApplicationTests > contextLoads() FAILED
    java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:98
        Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1804
            Caused by: java.lang.IllegalStateException at AbstractHandlerMethodMapping.java:669

1 test completed, 1 failed

> Task :test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///C:/Users/nerin/Desktop/4.%20myproject/2.%20visual%20studio%20code/QR/build/reports/tests/test/index.html

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 6s
7 actionable tasks: 5 executed, 2 up-to-date

 

본인 프로젝트 루트 폴더에 build 폴더 안에 있는 파일들을 삭제시킨 후 재빌드 하면 된다.

 

삭제 후 다시 빌드해보면 정상적으로 작동한다!

 

끝!

댓글