Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Configuring Multiple WebApp Source Directory


available since jetty-6.1.12.rc2 and jetty-7.0.0pre3

It can be configured by passing Resource[], String[], or String (csv) in the constructor.
The primary resource(first in the list) is the main resource.

WEB-INF/lib and WEB-INF/classes are merged.
This basically means your dependent classes on webappA will be available in the classpath for webappB.
This feature enables webapp overlays.

Configuration in context.xml

Code Block
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "">

<Configure class="org.mortbay.jetty.webapp.WebAppContext">
  <Set name="contextPath">/</Set>
  <Set name="baseResource">
    <New class="org.mortbay.resource.ResourceCollection">
        <Array type="java.lang.String">
          <Item><SystemProperty name="jetty.home" default="."/>/webapps/foo</Item>


Configuration in jetty-maven-plugin

Code Block
<!-- comma(or semi-colon) separated values-->
            <baseResource implementation="org.mortbay.resource.ResourceCollection">

When maven fails to dependency-inject overloaded resources, use:

Note that for the other webapp sources, you can add them to the plugin's extra scan targets for dynamic reload.


Code Block









<resources>webappY/src/main/webapp, webappX/src/main/webapp</resources>

Code Block
When Y(first resource) extends/overrides X, you get:


/bar.jsp (Y)


/WEB-INF/web.xml (Y)




available since jetty-6.1.12.rc3 and jetty-7.0.0pre4

When using mvn jetty:run, you don't need to configure anything.
Just add a dependency like:

Code Block

If configured manually, it would look like:

Code Block

The order of the overlays depends on how you arrange the war dependencies in your pom.xml (top to bottom)

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