Apache Maven 1.x has reached its end of life, and is no longer supported. For more information, see the announcement. Users are encouraged to migrate to the current version of Apache Maven.

War Settings

PropertyOptional?Description
maven.war.src Yes Location of the webapp in the source tree. Your WEB-INF directory must be located right under ${maven.war.src}. It defaults to ${maven.src.dir}/webapp.
maven.war.src.includes Yes Comma or space separated list of Ant path patterns specifying what files and directories from ${maven.war.src} that should be included in the web application. All files are included by default.
maven.war.src.excludes Yes Comma or space separated list of Ant path patterns specifying what files and directories from ${maven.war.src} that should be excluded from the web application. No files are excluded by default.
maven.war.expansion.excludes Yes Comma or space separated list of Ant path patterns specifying the files and directories from ${maven.war.src} that should be excluded from the copy when performing property expansion. If property expansion is not enabled this property is ignored. Files in this excludes list are copied to the webapp without property expansion afterwards. No files are excluded by default.
maven.war.src.filtering Yes Indicates whether token filtering should take place during the copy. Default is true.
maven.war.property.expansion Yes Whether to perform property expansion for copied resources. Default to false.
maven.war.webxml Yes Location of the web.xml file. It defaults to ${maven.war.src}/WEB-INF/web.xml.
maven.war.classes.includes Yes Classes to include from WEB-INF/classes Note: Classes are relative to ${maven.build.dest}.
maven.war.classes.excludes Yes Classes to exclude from WEB-INF/classes Note: Classes are relative to ${maven.build.dest}.
maven.war.final.name Yes

Name of the war file that is built.

Defaults to ${pom.artifactId}.war

Use ${pom.artifactId}-${pom.currentVersion} to mimic the files created using the jar and ear plugins

maven.war.build.dir Yes Directory where the war will be generated. It defaults to ${maven.build.dir}.
maven.war.webapp.dir Yes Directory where the webapp will be generated. It defaults to ${maven.war.build.dir}/${pom.artifactId}.
maven.war.manifest Yes Location of the MANIFEST.MF file in the source tree. It defaults to ${maven.war.src}/META-INF/MANIFEST.MF.
maven.war.webxml.overwrite Yes Specify if the web.xml contained in the source tree should overwrite the one in the generated webapp directory. Default to true.
maven.war.resources.overwrite Yes Specify if resources contained in maven.war.webapp.dir should overwrite existing resources in the generated webapp directory. Default to true.
maven.war.index Yes Whether to create an index list to speed up classloading. This is a JDK 1.3+ specific feature. Defaults to false.
maven.war.tld.dir Yes Subdirectory of web application context root directory where tag library descriptors (tld files) will be copied. The Maven WAR Plugin copies to this location all dependencies, specified in the POM, of the type tld and marked with a property of war.bundle set to true. See the section below for more information.

It defaults to WEB-INF/tld. This setting is adhering to SUN Code Conventions for the JavaServer Pages

Including artifacts in the Webapp

You must tell Maven what artifacts you want included in the Webapp. This is achieved by specifying a property in the POM, using the following syntax:

  <dependency>
    <groupId>grpId</groupId>
    <artifactId>jarid</artifactId>
    <version>jarversion</version>
    <type>jar</type>
    <properties>
      <war.bundle>true</war.bundle>
    </properties>
  </dependency>
  
  <dependency>
    <groupId>grpId</groupId>
    <artifactId>tldid</artifactId>
    <version>tldversion</version>
    <type>tld</type>
    <properties>
      <war.bundle>true</war.bundle>
    </properties>
  </dependency>

This process is type senstive. Currently following types are supported:

  1. jar (bundled into WEB-INF/lib)
  2. tld (bundled into WEB-INF/tld, see: maven.war.tld.dir)