我有一個不在intellj中運行的Spring啓動應用程序,即使這個應用程序在eclipse中運行,我總是必須將構建路徑中的「Jre庫」移動到頂部,然後運行mvn install。運行彈簧啓動應用程序時編譯錯誤
整個代碼可以在這裏找到 - https://github.com/iftekharkhan09/SpringCaching.git
誰能請在什麼問題上需要幫助。
錯誤: - 當我運行mvn乾淨後再裝人
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
發生此錯誤。
「不在intellij中運行」是什麼意思?它是否編譯?如果不是,編譯錯誤是什麼?如果它編譯了,但是當你運行'SpringDemoAppApplication'時失敗了,那麼你能描述一下**該失敗是什麼?你有堆棧跟蹤嗎?此應用程序是否從命令行構建並運行? – glytching
@ glitch:在問題中添加了錯誤。 –