1
votes

I'm writing extension to java web application. I add this application to my extension with maven overlay plugin and use web.xml file and webapp folder from main application. Also I want to write integration test platform for my extension with jetty embedded server. I've tried

    @Test
public void jetty() throws Exception {
    Server server = new Server(9090);
    WebAppContext context = new WebAppContext();
    context.setDescriptor("WEB-INF/web.xml");
    context.setResourceBase("src/main/webapp");
    context.setContextPath("/");
    context.setParentLoaderPriority(true);

    server.setHandler(context);
    server.start();
    server.join();
}

But jetty can't find web.xml file from overlayed project. How i need to write the path to web.xml and webapp directory to make embbedded jetty work?

1

1 Answers

0
votes

I have given the full path and works perfectly for me, something like this:

context.setDescriptor("src/main/webapp/WEB-INF/web.xml");