Maven Struts Plug-in Build File

Maven utilizes Ant to provide users with an easy-to-use and familiar interface to manage projects that have been described with a valid Maven project descriptor. The build files that Maven installs are stored in ${maven.home} directory.

This document describes the Ant build file and targets that are available when using the Struts Plug-in with Maven.

The current recommended approach to using Maven is to add delegators to these Maven-provided targets in your project's main build file. This will enable you to use your existing build file with the additional Maven functionality. In addition, it is also recommended that you load a standard set of property files. The property files will setup your environment, ${lib.repo} and ${maven.home}, and allow you to override Maven defaults properties. Please refer to the Integration document for more information on how to integrate these build targets into your project.

The following table contains a brief overview of the build file that is installed as part of the Maven Struts Plug-in in the ${maven.home}/plugin/struts directory. In addition, the various Ant targets in this file is discussed.

Build FileDescription
build.xml Contains a target validate Struts WAR files.

The build file utilizes various properties for default and user-configurable settings. All Struts Plug-in properties are described in the Properties document. The rest of this document assumes your project follows the standard Directory Layout; however, it is possible to override many of these defaults.

struts/build.xml

TargetDescription
maven:validate-struts-warValidate a Struts WAR file.

maven:validate-struts-war

The maven:validate-struts-war target validates the struts war file.

The validator checks the folowing:

  1. It's a valid war file as per the J2EE War Validator
  2. The war file has a struts configuration, usually WEB-INF/struts-config.xml
  3. Form Beans defined by a <form-bean> tag have a type that is loadable from the war file and not the classpath. If the form bean has a className, that class too must be loaded from the war
  4. Actions defined by a <action< tag have several validations:
    1. the className attribute must be a class loadable from the war
    2. the name attribute, must match a <form-bean> name attribute.
    3. the path attribute must start with a forward slash, i.e. '/'
    4. the scope attribute must be one of request or sesssion
    5. the type attribute must be a class loadable from the war
    6. the unknown and validate attributes must be either true or false