The JavaTM Web Services Tutorial
Home
TOC
Index
PREV TOP NEXT
Divider

Running Manager Commands Using Ant Tasks

The version of Ant distributed with the Java WSDP supports tasks that invoke manager commands, thus allowing you to run the commands from a terminal window. The tasks are summarized in Table B-2.

Table B-2 Ant Web Application Manager Tasks
Function
Ant Task Syntax
list
<list url="url" username="username"   password="password" />
install
<install url="url" path="mywebapp" war=""  username="username" password="password" />

The value of the war attribute can be a WAR file (jar:file:/path/to/mywebapp.war!/) or an unpacked directory (file:/path/to/mywebapp).
reload
<reload url="url" path="mywebapp"  username="username" password="password" />
deploy
<deploy url="url" path="mywebapp"   war="file:/path/to/mywebapp.war"  username="username" password="password" />
undeploy
<undeploy url="url" path="mywebapp"   username="username" password="password" />
remove
<remove url="url" path="mywebapp"  username="username" password="password" />


Note: An application that is installed is not available after Tomcat is restarted. To make an application permanently available, use the deploy task.

Since a user of the manager is required to be authenticated, the Ant tasks take username and password attributes in addition to the URL. Instead of embedding these in the Ant build file, you can use the approach followed by the tutorial examples. You set the username and password properties in a file named build.properties in your home directory as follows:

username=ManagerName
password=ManagerPassword
 

Replace ManagerName and ManagerPassword with the values you specified for the user name and password when you installed the Java WSDP.


Note: On Windows, your home directory is the directory where your Windows profile is stored. For example, on Windows 2000 it would be C:\Documents and Settings\yourProfile.

The Ant build files import these properties with the following element:

<property file="${user.home}/build.properties"/>
 
Divider
Home
TOC
Index
PREV TOP NEXT
Divider

This tutorial contains information on the 1.0 version of the Java Web Services Developer Pack.

All of the material in The Java Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.