[ERROR][TaskAgile] The project was not built since its build path is incomplete. Cannot fine the class file for org.mockito.A~
2020. 11. 29. 22:33ㆍ개발 관련/ERROR
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[18,26] package org.mockito does not exist
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[18,1] static import only from classes and interfaces
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[19,26] package org.mockito does not exist
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[19,1] static import only from classes and interfaces
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[47,5] cannot find symbol
symbol: method doThrow(java.lang.Class<com.taskagile.domain.model.user.UsernameExistsException>)
location: class com.taskagile.web.apis.RegistrationApiControllerTests
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[66,5] cannot find symbol
symbol: method doThrow(java.lang.Class<com.taskagile.domain.model.user.EmailAddressExistsException>)
location: class com.taskagile.web.apis.RegistrationApiControllerTests
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[85,5] cannot find symbol
symbol: method doNothing()
location: class com.taskagile.web.apis.RegistrationApiControllerTests
[INFO] 7 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.708 s
[INFO] Finished at: 2020-11-24T15:16:41+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project app: Compilation failure: Compilation failure:
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[18,26] package org.mockito does not exist
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[18,1] static import only from classes and interfaces
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[19,26] package org.mockito does not exist
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[19,1] static import only from classes and interfaces
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[47,5] cannot find symbol
[ERROR] symbol: method doThrow(java.lang.Class<com.taskagile.domain.model.user.UsernameExistsException>)
[ERROR] location: class com.taskagile.web.apis.RegistrationApiControllerTests
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[66,5] cannot find symbol
[ERROR] symbol: method doThrow(java.lang.Class<com.taskagile.domain.model.user.EmailAddressExistsException>)
[ERROR] location: class com.taskagile.web.apis.RegistrationApiControllerTests
[ERROR] /C:/Users/sr/practice/TaskAgile/vuejs.spring-boot.mysql/src/main/java/com/taskagile/web/apis/RegistrationApiControllerTests.java:[85,5] cannot find symbol
[ERROR] symbol: method doNothing()
[ERROR] location: class com.taskagile.web.apis.RegistrationApiControllerTests
그리고 vscode의 문제(error)에서는
project file에서)
The project was not built since its build path is incomplete. Cannot find the class file for org.mockito.Answers. Fix the build path then try building this project
tests.java 에서)
The type org.mockito.Answers cannot be resolved. It is indirectly referenced from required .class files
ERROR 내용
- build path가 불완전하다.~ org.mockito.Answers 가 .class 파일에서 간접적으로 필요한데포함되지않았다.
- pom.xml 확인 - scope에서 test 지움 -> 해결되었다...?
해결 방법
- scope에서 test 지움
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.6.0</version>
</dependency>
참고 사이트 :