Jetty Logo
Contact the core Jetty developers at www.webtide.com

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

Hot Deployment

Jetty lets you deploy an arbitrary context or web application by monitoring a directory for changes. If you add a web application or a context descriptor to the directory, Jetty's DeploymentManager (DM) deploys a new context. If you touch or update a context descriptor, the DM stops, reconfigures, and redeploys its context. If you remove a context, the DM stops it and removes it from the server.

To control this behavior, you'll want to configure some WebAppProvider properties.

monitoredDirName

The directory to scan for possible deployable Web Applications (or Deployment Descriptor XML files)

scanInterval

Number of seconds between scans of the provided monitoredDirName.

A value of 0 disables the continuous hot deployment scan, Web Applications will be deployed on startup only.

The default location for this configuration is in the ${jetty.home}/etc/jetty-deploy.xml file.

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">

  <Call name="addBean">
    <Arg>
      <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
        <Set name="contexts">
          <Ref refid="Contexts" />
        </Set>
        <Call name="setContextAttribute">
          <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
          <Arg>.*/servlet-api-[^/]*\.jar$</Arg>
        </Call>

        <Call id="webappprovider" name="addAppProvider">
          <Arg>
            <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
              <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
              <Set name="defaultsDescriptor"><Property name="jetty.home" default="." />/etc/webdefault.xml</Set>
              <Set name="scanInterval">1</Set>
              <Set name="extractWars">true</Set>
            </New>
          </Arg>
        </Call>
      </New>
    </Arg>
  </Call>
</Configure>    

See Understanding the Default WebAppProvider for more configuration details.

See also Deployment Architecture for detailed conceptual information.

See an error or something missing? Contribute to this documentation at Github!