Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Jetty/Howto/Deploy Web Applications

< Jetty‎ | Howto


Jetty 7 and Jetty 8 are now EOL (End of Life)


All development and stable releases are being performed with Jetty 9 and Jetty 10.

This wiki is now officially out of date and all content has been moved to the Jetty Documentation Hub

Direct Link to updated documentation:

Jetty can deploy web applications as WAR files (packed or unpacked), as provided or with overridden configuration, and with static or hot deployment.

Deploying Webapps

Jetty scans its $JETTY_HOME/webapps directory at startup for web applications to deploy:

  • It deploys the file foo.war as a webapp at context /foo.
  • It deploys the directory foo/ at context /foo. If the directory has a WEB-INF subdirectory, Jetty treats it as a servlet webapp, otherwise Jetty serves it only as static content.
  • If both a foo.war and a foo/ directory exist, Jetty uses the one with the most recent last-modified date.
  • If the webapp is called root.war or the directory is called root/ then Jetty deploys it at the / context.
  • If the contextXmlDir option is used and a foo.xml file exists in that dir, the WebAppProvider defers to the Contexts Provider for actual webapp deployment.

Formerly the WebAppDeployer class controlled webapp deployment. With Jetty version 7.0.2 and later, the WebAppProvider of the DeploymentManager controls web app deployment..

See also older (but mostly relevant) Jetty-6 WebAppDeployer documentation.

Deploying Contexts

Jetty scans the $JETTY_HOME/contexts directory at runtime for context.xml files that describe either:

  • a standard WAR file (or directory), plus additional configuration.
  • a custom Jetty context.

Formerly the ContextDeployer class contolled contexts deployment. With Jetty version 7.0.2 and later, the ContextProvider of the DeploymentManager controls contexts deployment.

See also older (but mostly relevant) Jetty-6 ContextDeployer documentation.

Jetty Maven Plugin

If you develop your web application as a Maven project, you can deploy it in Jetty with mvn jetty:run using the Jetty Maven Plugin.

Maven lets you build your web applications by overlaying on other template web applications (for example, Cometd) and manages the transitive dependencies needed to populate WEB-INF/lib.

OSGi web application bundle


Using Embedded Jetty

You can also deploy web applications into embedded Jetty, either via direct configuration or via configuration of a deployer. For an example see the Embedding Jetty Tutorial.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.