Teamcity - 包 javax.servlet 不存在
Teamcity - package javax.servlet does not exist
如何在 Teamcity 中导入 javax.servlet
?当我尝试通过 teamcity IntelliJ IDEA runner 构建 java 项目时出现以下错误消息。
我应该将 servlet-api.jar
复制到 teamcity 服务器并在 Teamcity -> Build Configuration -> General Settings -> Artifact paths 或 Teamcity -> Build Configuration -> 下指定 servlet-api.jar
的路径构建步骤:testStep -> 要构建的工件?
这是我第一次使用 teamcity,我正在使用这个 https://github.com/marekbruchaty/SimpleJavaWebApp 项目。我有一个 CentOS 服务器,它有 teamcity 和 gitlab。
在我的桌面上,我可以使用 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
想通了。
我不得不将 servlet-api.jar 的路径粘贴到构建步骤 -> 项目 SDKs -> JDK Jar 文件模式中。
如何在 Teamcity 中导入 javax.servlet
?当我尝试通过 teamcity IntelliJ IDEA runner 构建 java 项目时出现以下错误消息。
我应该将 servlet-api.jar
复制到 teamcity 服务器并在 Teamcity -> Build Configuration -> General Settings -> Artifact paths 或 Teamcity -> Build Configuration -> 下指定 servlet-api.jar
的路径构建步骤:testStep -> 要构建的工件?
这是我第一次使用 teamcity,我正在使用这个 https://github.com/marekbruchaty/SimpleJavaWebApp 项目。我有一个 CentOS 服务器,它有 teamcity 和 gitlab。
在我的桌面上,我可以使用 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
想通了。
我不得不将 servlet-api.jar 的路径粘贴到构建步骤 -> 项目 SDKs -> JDK Jar 文件模式中。