0

How do I import javax.servlet in Teamcity? I have the below error message when I try to build the java project through teamcity IntelliJ IDEA runner.

This is my first time with teamcity and I'm using this https://github.com/marekbruchaty/SimpleJavaWebApp project. I have a CentOS server which has teamcity and gitlab.

From my desktop, using IntelliJ IDEA I can import servlet.api to do a successful build. But the teamcity is in another location and managed remotely and I wonder how to import the servlet-api into teamcity?

Where should I add the servlet-api.jar as a dependency in teamcity so it can compile?

Here is the build error:

/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
user630702
  • 465
  • 6
  • 25

1 Answers1

1

Figured it out.

I had to paste the path to servlet-api.jar into Build Step -> Project SDKs -> JDK Jar files patters.

user630702
  • 465
  • 6
  • 25