包org.springframework.stereotype不存在等等

时间:2016-04-12 15:13:49

标签: java spring maven intellij-idea

我有一个使用Spring和IntelliJ的Web应用程序项目,到目前为止它一直运行良好,但今天我尝试运行它并开始给我这个错误

这只是一小部分

Error:(27, 29) java: cannot find symbol
  symbol:   class RequestParam
  location: class com.eina.as.controladores.ControladorHome
Error:(8, 47) java: package org.springframework.web.bind.annotation does not exist
Error:(19, 6) java: cannot find symbol
  symbol:   class RequestMapping
  location: class com.eina.as.controladores.ControladorHome
Error:(25, 6) java: cannot find symbol
  symbol:   class RequestMapping
  location: class com.eina.as.controladores.ControladorHome
Error:(42, 26) java: cannot find symbol
  symbol:   class RequestParam
  location: class com.eina.as.controladores.ControladorHome
Error:(28, 29) java: cannot find symbol
  symbol:   class RequestParam
  location: class com.eina.as.controladores.ControladorHome
Error:(6, 38) java: package org.springframework.stereotype does not exist
Error:(9, 47) java: package org.springframework.web.bind.annotation does not exist
Error:(44, 25) java: cannot find symbol
  symbol:   class HttpServletRequest
  location: class com.eina.as.controladores.ControladorHome
Error:(43, 26) java: cannot find symbol
  symbol:   class RequestParam
  location: class com.eina.as.controladores.ControladorHome
Error:(11, 26) java: package javax.servlet.http does not exist
Error:(41, 6) java: cannot find symbol
  symbol:   class RequestMapping
  location: class com.eina.as.controladores.ControladorHome
Error:(29, 29) java: cannot find symbol
  symbol:   class RequestParam
  location: class com.eina.as.controladores.ControladorHome
Error:(16, 2) java: cannot find symbol
  symbol: class Controller
Error:(7, 47) java: package org.springframework.web.bind.annotation does not exist
Error:(26, 29) java: cannot find symbol
  symbol:   class RequestParam
  location: class com.eina.as.controladores.ControladorHome

还有更多错误,但它们与上述基本相同。我不知道发生了什么,我试图重新导入“pom.xml”,但它什么也没做。我已经删除并克隆了几次项目。

提前致谢

1 个答案:

答案 0 :(得分:0)

清理maven项目。然后更新项目快照或更新maven项目。还要检查m2目录中的依赖项。然后再次重建项目。

  1. 清理Maven项目。项目 - > RightClick - >运行方式 - > Maven Clean
  2. 更新Maven项目。 项目 - >右键单击 - > Maven - > Upadte项目 将打开一个新窗口。选择项目并勾选"强制更新快照"。然后更新。
  3. 重建项目。右键单击 - >以 - >运行Maven安装