25 Using the Coherence*Web Installer Ant Task

The Coherence*Web Installer Ant task enables you to run the Coherence*Web Installer from within your existing Ant build files.

25.1 How to Use the Installer Ant Task

To use the Coherence*Web Installer Ant task, add the following task import statement to your Ant build file:

<taskdef name="cwi" classname="com.tangosol.coherence.misc.CoherenceWebAntTask">
    <classpath>
        <pathelement location="${coherence.home}/lib/webInstaller.jar"/>
    </classpath>
</taskdef>

In this code fragment, ${coherence.home} refers to the root directory of your Coherence installation.

To Install Coherence*Web into a Java EE Application:

  1. Build your Java EE application as you normally would.

  2. Run the Coherence*Web Ant task with the operations attribute set to inspect.

  3. Make any necessary changes to the generated Coherence*Web XML descriptor.

  4. Run the Coherence*Web Ant task with the operations attribute set to install.

To Use the Ant Task in an Iterative Development Environment:

If you are performing iterative development on your application (such as modifying JSPs, Servlets, static resources, and so on), use the following installation process:

  1. Run the Coherence*Web Ant task with the operations attribute set to uninstall, the failonerror attribute set to false, and the descriptor attribute set to the location of the previously generated Coherence*Web XML descriptor (from Step 2 in the previous section).

  2. Build your Java EE application as you normally would.

  3. Run the Coherence*Web Ant task with the operations attribute set to inspect, install and the descriptor attribute set to the location of the previously generated Coherence*Web XML descriptor (from Step 2 in the previous section).

To Change a Coherence*Web Configuration where it is already Installed:

To change the Coherence*Web configuration settings of a Java EE application that already has Coherence*Web installed, use this procedure:

  1. Run the Coherence*Web Ant task with the operations attribute set to uninstall and the descriptor attribute set to the location of the Coherence*Web XML descriptor for the Java EE application.

  2. Change the necessary configuration parameters in the Coherence*Web XML descriptor.

  3. Run the Coherence*Web Ant task with the operations attribute set to install and the descriptor attribute set to the location of the modified Coherence*Web XML descriptor (from step 2).

25.2 Installer Ant Task Parameters

Table 25-1 describes the Ant task installation parameters.

Table 25-1 Parameters for the Coherence*Web Installer Ant Task

Attribute Required Description

app

true, if the operations attribute is set to any value other than version

Path to the target Java EE application. This can be a path to a WAR file, an EAR file, an exploded WAR directory, or an exploded EAR directory.

backup

false

Path to a directory that will hold a backup of the original target Java EE application. This attribute defaults to the directory that contains the Java EE application.

descriptor

false

Path to the Coherence*Web XML descriptor. This attribute defaults to coherence-web.xml in the directory that contains the target Java EE application.

failonerror

false

Stop the Ant build if the Coherence*Web installer exits with a status other than 0. The default is true.

nowarn

false

Suppress warning messages. This attribute can be either true or false. The default is false.

operations

true

Comma- or space-separated list of operations to perform; each operation must be one of inspect, install, uninstall, or version.

server

false

The alias of the target Java EE application server.

touch

false

Touch JSPs and TLDs that are modified by the Coherence*Web installer. This attribute can be either true, false, or 'M/d/y h:mm a'. The default is false.

verbose

false

Show verbose output. This attribute can be either true or false. The default is false.


25.3 Examples

Inspect the myWebApp.war web application and generate a Coherence*Web XML descriptor called my-coherence-web.xml in the current working directory:

<cwi app="myWebApp.war" operations="inspect" descriptor="my-coherence-web.xml"/>

Install Coherence*Web into the myWebApp.war web application using the Coherence*Web XML descriptor called my-coherence-web.xml found in the current working directory:

<cwi app="myWebApp.war" operations="install" descriptor="my-coherence-web.xml"/>

Uninstall Coherence*Web from the myWebApp.war web application:

<cwi app="myWebApp.war" operations="uninstall">

Install Coherence*Web into the myWebApp.war web application located in the /dev/myWebApp/build directory using the Coherence*Web XML descriptor called my-coherence-web.xml found in the /dev/myWebApp/src directory, and place a backup of the original web application in the /dev/myWebApp/work directory:

<cwi app="/dev/myWebApp/build/myWebApp.war" operations="install" descriptor="/dev/myWebApp/src/my-coherence-web.xml" backup="/dev/myWebApp/work"/>

Install Coherence*Web into the myWebApp.war web application located in the /dev/myWebApp/build directory using the Coherence*Web XML descriptor called coherence-web.xml found in the /dev/myWebApp/build directory. If the web application has not already been inspected (that is, /dev/myWebApp/build/coherence-web.xml does not exists), inspect the web application before installing Coherence*Web:

<cwi app="/dev/myWebApp/build/myWebApp.war" operations="inspect,install"/>

Reinstall Coherence*Web into the myWebApp.war web application located in the /dev/myWebApp/build directory using the Coherence*Web XML descriptor called my-coherence-web.xml found in the /dev/myWebApp/src directory:

<cwi app="/dev/myWebApp/build/myWebApp.war" operations="uninstall,install" descriptor="/dev/myWebApp/src/my-coherence-web.xml"/>