Where should I place jar files that are needed to build successfully?

Answered

I have a gitlab project which needs servlet-api.jar file in order to build successfully. But I tried adding the jar file path to CLASSPATH variable, copying it to /opt/teamcity/TeamCity/.BuildServer/lib/ and also in /root/buildAgent/lib/.

This is a Intellij IDEA project. Here is the project link: https://github.com/marekbruchaty/SimpleJavaWebApp

Also in teamcity I tried pasting the full path /usr/local/tomcat/lib/servlet-api.jar in Build Step -> Artifacts to build

But I still get the error package javax.servlet does not exist.

Only thing I haven't tried is that under Build Configuration -> Dependencies there is a Artifact Dependencies. Is this the right place to add the path to servlet-api.jar? Should it be a full path? what is the format to paste here? There is a source and destination. I'm not sure how to define the source path and also don't know what the destination path should be? This the first time I"m using teamcity and still learning about it.

Here is the 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
1 comment
Comment actions Permalink

I tried using your project, but the xml files are missing from the .idea folder in your repository. Can you share a screenshot of each of your build steps to help us understand how you're set up?

0

Please sign in to leave a comment.