我试图让Maven清理/安装,但这是我安装时会发生的事情:
select avg(convert(float,score))
from GradingScores
where isnumeric(score)=1
我不知道这是怎么回事。我发现删除.m2文件夹可以解决问题,但它没有。
这是我的pom:
...
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 53 source files to C:\demoBancoWeb\target\classes
[INFO] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/dao/ConsignacionesDAO.java: Some input files use unchecked or unsafe operations.
[INFO] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/dao/ConsignacionesDAO.java: Recompile with -Xlint:unchecked for details.
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[4,21] package javax.servlet does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[5,21] package javax.servlet does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[6,32] package javax.servlet.annotation does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[7,26] package javax.servlet.http does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[8,26] package javax.servlet.http does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[9,26] package javax.servlet.http does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[19,37] cannot find symbol
symbol: class HttpServlet
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[18,2] cannot find symbol
symbol: class WebServlet
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[35,26] cannot find symbol
symbol: class ServletConfig
location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[35,55] cannot find symbol
symbol: class ServletException
location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[49,30] cannot find symbol
symbol: class HttpServletRequest
location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[49,58] cannot find symbol
symbol: class HttpServletResponse
location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[49,95] cannot find symbol
symbol: class ServletException
location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[61,31] cannot find symbol
symbol: class HttpServletRequest
location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[61,59] cannot find symbol
symbol: class HttpServletResponse
location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[61,96] cannot find symbol
symbol: class ServletException
location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/vista/LoginView.java:[8,26] package javax.servlet.http does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/controller/OperacionesMatematicas.java:[3,30] package javax.websocket.server does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/vista/LoginView.java:[39,27] cannot find symbol
symbol: class HttpSession
location: class co.edu.icesi.demo.vista.LoginView
[INFO] 19 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:10 min
[INFO] Finished at: 2016-05-20T21:41:51-05:00
[INFO] Final Memory: 20M/143M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project demoBancoWeb: Compilation failure: Compilation failure:
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[4,21] package javax.servlet does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[5,21] package javax.servlet does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[6,32] package javax.servlet.annotation does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[7,26] package javax.servlet.http does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[8,26] package javax.servlet.http does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[9,26] package javax.servlet.http does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[19,37] cannot find symbol
[ERROR] symbol: class HttpServlet
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[18,2] cannot find symbol
[ERROR] symbol: class WebServlet
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[35,26] cannot find symbol
[ERROR] symbol: class ServletConfig
[ERROR] location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[35,55] cannot find symbol
[ERROR] symbol: class ServletException
[ERROR] location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[49,30] cannot find symbol
[ERROR] symbol: class HttpServletRequest
[ERROR] location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[49,58] cannot find symbol
[ERROR] symbol: class HttpServletResponse
[ERROR] location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[49,95] cannot find symbol
[ERROR] symbol: class ServletException
[ERROR] location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[61,31] cannot find symbol
[ERROR] symbol: class HttpServletRequest
[ERROR] location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[61,59] cannot find symbol
[ERROR] symbol: class HttpServletResponse
[ERROR] location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/servlet/ControlCliente.java:[61,96] cannot find symbol
[ERROR] symbol: class ServletException
[ERROR] location: class co.edu.icesi.demo.servlet.ControlCliente
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/vista/LoginView.java:[8,26] package javax.servlet.http does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/controller/OperacionesMatematicas.java:[3,30] package javax.websocket.server does not exist
[ERROR] /C:/demoBancoWeb/src/main/java/co/edu/icesi/demo/vista/LoginView.java:[39,27] cannot find symbol
[ERROR] symbol: class HttpSession
[ERROR] location: class co.edu.icesi.demo.vista.LoginView
[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
提前致谢
答案 0 :(得分:4)
由于缺少servlet-api。在你的pom中加入以下依赖
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version> //Change the version as per your needs
<scope>provided</scope> //use provided if you are deploying war in a container
</dependency>
答案 1 :(得分:0)
Maven无法在其存储库中找到servlet-api.jar,因此在编译时无法找到依赖项。我们应该在Pom.xml中添加依赖项,以便maven可以下载所需的servlet-api.jar及其相关的jar。