我有一个没有在intellj中运行的Spring启动应用程序,即使这个应用程序在eclipse中运行,我总是要移动" Jre库"在构建路径中直到顶部,然后运行mvn install。
整个代码可以在 - https://github.com/iftekharkhan09/SpringCaching.git
找到任何人都可以帮忙解决问题。
错误: -
INFO] -------------------------------------------------------------
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[6,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[7,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[8,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[9,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[10,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[16,1] error: cannot find symbol
[ERROR] class RestController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[17,1] error: cannot find symbol
[ERROR] class RequestMapping
/Git Code/SpringCaching/src/main/java/com/myapp/service/impl/ContactServiceImpl.java:[15,31] error: package org.springframework.http does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/exception/ApiError.java:[6,31] error: package org.springframework.http does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/exception/ApiError.java:[11,9] error: cannot find symbol
[ERROR] class ApiError
/Git Code/SpringCaching/src/main/java/com/myapp/exception/ApiError.java:[22,17] error: cannot find symbol
[ERROR] class ApiError
/Git Code/SpringCaching/src/main/java/com/myapp/exception/ApiError.java:[27,17] error: cannot find symbol
[ERROR] class ApiError
/Git Code/SpringCaching/src/main/java/com/myapp/exception/ApiError.java:[34,17] error: cannot find symbol
[ERROR] class ApiError
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[25,2] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[31,25] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[30,2] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[36,26] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[35,2] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[40,2] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[47,28] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[46,2] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[52,29] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[51,2] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[57,28] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[56,2] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[62,28] error: cannot find symbol
[ERROR] class ContactController
/Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[61,2] error: cannot find symbol
[INFO] 27 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.233 s
[INFO] Finished at: 2017-10-21T19:11:45+05:30
[INFO] Final Memory: 29M/299M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project SpringCaching: Compilation failure: Compilation failure:
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[6,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[7,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[8,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[9,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[10,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[16,1] error: cannot find symbol
[ERROR] class RestController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[17,1] error: cannot find symbol
[ERROR] class RequestMapping
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/service/impl/ContactServiceImpl.java:[15,31] error: package org.springframework.http does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/exception/ApiError.java:[6,31] error: package org.springframework.http does not exist
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/exception/ApiError.java:[11,9] error: cannot find symbol
[ERROR] class ApiError
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/exception/ApiError.java:[22,17] error: cannot find symbol
[ERROR] class ApiError
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/exception/ApiError.java:[27,17] error: cannot find symbol
[ERROR] class ApiError
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/exception/ApiError.java:[34,17] error: cannot find symbol
[ERROR] class ApiError
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[25,2] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[31,25] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[30,2] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[36,26] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[35,2] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[40,2] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[47,28] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[46,2] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[52,29] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[51,2] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[57,28] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[56,2] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[62,28] error: cannot find symbol
[ERROR] class ContactController
[ERROR] /Git Code/SpringCaching/src/main/java/com/myapp/controller/ContactController.java:[61,2] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Process finished with exit code 1
当我运行mvn clean然后man install。
时会发生此错误答案 0 :(得分:0)
pom.xml中的spring-boot-starter-web依赖项有scope = test但你使用该工件提供的类有非测试代码,所以只需从该依赖项中移除scope元素,然后删除' web&# 39;课程将在您的主要'源树。