Teamcity-包javax.servlet不存在

问题描述 投票:0回答:1

如何在Teamcity中导入javax.servlet?当我尝试通过teamcity IntelliJ IDEA运行器构建Java项目时,出现以下错误消息。

我应该将servlet-api.jar复制到teamcity服务器并在Teamcity->构建配置->常规设置->工件路径或Teamcity->构建配置->构建步骤:testStep-> Artifacts下指定servlet-api.jar的路径建立?

这是我第一次参加teamcity,我正在使用这个https://github.com/marekbruchaty/SimpleJavaWebApp项目。我有一台具有teamcity和gitlab的CentOS服务器。

从我的桌面,使用IntelliJ IDEA,我可以导入servlet.api来成功构建。但是teamcity在另一个位置并且是远程管理的,我想知道如何将servlet-api导入teamcity吗?

这里是构建错误:

/root/buildAgent/work/f096a35a2a7f853/src/FormServlet.java:1: package javax.servlet does not exist
import javax.servlet.ServletException;
                    ^
/root/buildAgent/work/f096a35a2a7f853/src/FormServlet.java:2: package javax.servlet.http does not exist
import javax.servlet.http.HttpServlet;
                         ^
/root/buildAgent/work/f096a35a2a7f853/src/FormServlet.java:3: package javax.servlet.http does not exist
import javax.servlet.http.HttpServletRequest;
                         ^
/root/buildAgent/work/f096a35a2a7f853/src/FormServlet.java:4: package javax.servlet.http does not exist
import javax.servlet.http.HttpServletResponse;
                         ^
/root/buildAgent/work/f096a35a2a7f853/src/FormServlet.java:5: package javax.servlet.annotation does not exist
import javax.servlet.annotation.WebServlet;
                               ^
/root/buildAgent/work/f096a35a2a7f853/src/FormServlet.java:13: cannot find symbol
  symbol: class HttpServlet
public class FormServlet extends HttpServlet {
                                 ^
/root/buildAgent/work/f096a35a2a7f853/src/FormServlet.java:12: cannot find symbol
  symbol: class WebServlet
@WebServlet(name = "FormServlet")
 ^
/root/buildAgent/work/f096a35a2a7f853/src/FormServlet.java:14: cannot find symbol
  symbol:   class HttpServletRequest
  location: class FormServlet
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                          ^
/root/buildAgent/work/f096a35a2a7f853/src/FormServlet.java:14: cannot find symbol
  symbol:   class HttpServletResponse
  location: class FormServlet
java servlets teamcity
1个回答
0
投票

想通了。

我必须将servlet-api.jar的路径粘贴到Build Step-> Project SDKs-> JDK Jar文件中。

© www.soinside.com 2019 - 2024. All rights reserved.