Maven War Plugin

This plug-in provides the ability to generate either a deployed webapp or a webapp packaged as a WAR file.

Bundling dependencies

If you need to add extra dependencies in the web application, there are two properties you can use.

war.bundleThis property includes the dependency in /WEB-INF/lib
war.target.pathThis bundles the dependency in the path specified relative to the base of the web application.

For example, the following adds commons-lang to /WEB-INF/lib and myApplet to the /applets directory.

  <dependency>
    <id>commons-lang</id>
    <version>2.0</version>
    <properties>
      <war.bundle>true</war.bundle>
    </properties>
  </dependency>

  <dependency>
    <id>myApplet</id>
    <version>1.4</version>
    <properties>
      <war.target.path>applets</war.target.path>
    </properties>
  </dependency>

Filtering web.xml

If you need to copy the web.xml file in order to replace some filter tokens or simply perform some custom modification to it, simply write a pre-goal to the war:war-resources goal in which you perform the manipulation. Then set the maven.war.webxml property to point to your modified web.xml.