Ant script fails if attribute contains quotes
 Technote (FAQ)
 
Problem
If your Ant script has an attribute which requires quotes, you may experience the following error:

BUILD FAILED
file:C:/Temp/build.xml:19: Element type "wsInstallApp" must be followed by either attribute specifications, ">" or "/>".

Note: The Element type will be different depending on your ant script.
 
Cause
The problem is caused by some attributes require quotes to be used, and ant interprets the first quote it comes across as the end of the attribute.

For example, the following snippet shows an ant task which will deploy the Default Application onto a server and map the web module to the default_host virtual host.

<taskdef name="wsInstallApp" classname="com.ibm.websphere.ant.tasks.InstallApplication"/>

<target name="installAppWAS602Server" >
<wsInstallApp
wasHome="C:/WebSphere51/AppServer"
ear="C:/WebSphere51/AppServer/installableApps/DefaultApplication.ear"
conntype="SOAP"
host="localhost"
options="-MapWebModToVH {{"Default Web Application" DefaultWebApplication.war,WEB-INF/web.xml default_host}}"
port="8880"/>
</target>


The problem in this example is that the name of the WebModule, "Default Web Application" has to be put in quotes.
 
Solution
To resolve that, you need to substitute the characters you want to be interpreted as literal quotes as \&quot;

So the bold line above should be changed to:

options="-MapWebModToVH {{\&quot;Default Web Application\&quot;         DefaultWebApplication.war,WEB-INF/web.xml default_host}}"              

Note: Other substitution attempts with character combinations such as \" or \"" also failed.
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Administrative Scripting Tools (for example: wsadmin or ANT)
Operating system(s): Windows
Software version: 6.1
Software edition:
Reference #: 1251871
IBM Group: Software Group
Modified date: Dec 14, 2006