Jetty Logo
Version: 9.3.7.v20160115
Contact the core Jetty developers at

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery

Jetty override-web.xml

Using override-web.xml
Using the Jetty Maven Plugin
Additional Resources

To deploy a web application or WAR into different environments, most likely you will need to customize the webapp for compatibility with each environment. The challenge is to do so without changing the webapp itself. You can use a jetty.xml file for some of this work since it is not part of the webapp. But there are some changes that jetty.xml cannot accomplish, for example, modifications to servlet init-params and context init-params. Using webdefault.xml is not an option because Jetty applies webdefault.xml to a web application before the application's own WEB-INF/web.xml, which means that it cannot override values inside the webapp's web.xml.

The solution is override-web.xml. It is a web.xml file that Jetty applies to a web application after the application's own WEB-INF/web.xml, which means that it can override values or add new elements. You define it per-webapp, using the Jetty XML Syntax.

Using override-web.xml

You can specify the override-web.xml to use for an individual web application, in that webapp's jetty-web.xml.

The equivalent in code is:

Alternatively, use the classloader (Jetty Classloading) to get the path to the override descriptor as a resource.

Using the Jetty Maven Plugin

Use the <overrideDescriptor> tag as follows:

Additional Resources

  • webdefault.xml –Information for this web.xml -formatted file, applied before the webapp's web.xml webapp.

  • jetty.xml –Reference for jetty.xml files

See an error or something missing? Contribute to this documentation at Github!(Generated: 2016-03-17)