Antmod War Plugin

Generates a web application archive (WAR) for each "war" module in a release. More...

Release-level Ant targets:
war Builds one or more war file(s) by invoking the 'war-webapp' target and packing the results. This target generates a web application for each module with moduletype "main" or "war". The web application is generated in the "build/war" directory of the release.
Events fired: war-pre, war-post.
war-resources Copies files from "${antmod.war.src}" to "${antmod.war.dest}/modulename". (also includes files from the directory "${antmod.module.dirs.src.jsp}" if it exists in a war module)
Events fired: war-resources-pre, war-resources-post.
war-webapp Builds an exploded webapp in "${antmod.war.dest}/modulename". It invokes the 'war-resources' target and adds java libraries and module JARs from the release to generate an exploded webapp in that directory.
Events fired: war-webapp-pre, war-webapp-post.

Module-level Ant targets:
war-loadtokens Invoked during webapp generation to load an Ant-based tokenfilter named "antmod.war.tokenfilter". This Ant target is invoked only in the module with type "buildrelease" or "main", and can be implemented in its "local.build.xml" file.
Events fired: war-loadtokens-pre, war-loadtokens-post.

Configurable properties: [...]
antmod.war.dest Release-level directory where webapps and war files are generated. Defaults to ${antmod.release.dirs.build}/war.
antmod.war.src Module-level directory with source files. Defaults to ${antmod.module.dirs.src}/webapp.
antmod.war.src.includes Defines which files are included from the module-level source directory. Defaults to **.
antmod.war.src.excludes Defines which files are to-be-excludes from the module-level source directory. Defaults to being unset.
antmod.war.binaryfilefilter File filter used for copying non-binary files without token replacements, preventing corrupted binary files. Defaults to "**/*.jar, **/*.zip, **/*.gif, **/*.jpg, **/*.png, **/*.bmp, **/*.wmf, **/*.wmv, **/*.mpg, **/*.mpeg".
antmod.war.moduletypes Comma-separated list of module types for which a webapp is generated. Defaults to "main,war".
antmod.war.lib.javalib.includes Which java libraries present in the release should be included in the web application(s). Filter is relative to the "javalib" directory of the release. Defaults to **/*.jar.
antmod.war.lib.javalib.excludes Exclude filter for java libraries that should not be included in the web application(s). Filter is relative to the "javalib" directory of the release. Defaults to being unset.
antmod.war.lib.javalib.flatten Whether to ignore the directory structure of the release-level "javalib" directory, and put all javalibs in one directory inside the WAR. Defaults to true.
antmod.war.lib.module.includes Additional to-be-included module library files on top of the 'defaultincludes'. Filter is relative to the release directory. Defaults to being unset.
antmod.war.lib.module.excludes Additional to-be-excluded module library files on top of the 'defaultexcludes'. Filter is relative to the release directory. Defaults to "**/ojdbc*, **/servlet-api*, **/classes12*, **/jtds*".
antmod.war.lib.module.defaultincludes The default included module library files relative to the release directory. Defaults to "*/${antmod.jar.destdir}/*.jar,*/${antmod.module.dirs.lib}/**/*.jar".
antmod.war.lib.module.defaultexcludes The default excluded module library files relative to the release directory. Defaults to "**/*-tests.jar,_*/**,${antmod.release.dirs.build}/**".

Overview

The War plugin iterates across all modules in the release, doing the following for each module:

  1. First check if this module has one of the moduletypes defined in antmod.war.moduletypes
  2. If so, check if this module has a directory antmod.war.src
  3. If so, use the antmod.war.src contents as basis, and:
    • Create an "antmod.war.dest/modulename" directory with its contents
    • Add to it the java libraries and module libraries from the entire release
    • Replace all tokens in config files using the token values in antmod.war.tokenfilter that has been loaded by invoking the Ant target war-loadtokens in the main module.

The end result is an exploded webapp (per war module) in the "build/war" directory of the release, and packaged WAR files for each war module in the same directory.