rakesh mailgroups wrote:

Hi,

sometimes Ant gives you too many ways to do things and you cobble
something together that works but you think can probably done easier.
Here's what i am trying to do:

My web.xml needs to contain a full path to a config file. This path
should work whether on windows or unix. The location is always in a
subdirectory of the base dir. Here's my Ant code:

<path id="location.frontservletxmlfile">
        <pathelement location="${dir.web}" />
</path>
...
<pathconvert targetos="windows" property="win"
refid="location.frontservletxmlfile" />
  <echo>Path to xml file is: ${win}</echo>
  <copy file="${dir.conf}/web.xml.template" toFile="${dir.web}/web.xml">
     <filterset>
        
        <filter token="xml.location" value="${win}" />      </filterset>
  </copy>

the xml file goes from:
<param-value>@xml.location@/frontcontroller.xml</param-value>
to
<param-value>C:\Projects\HelloSample\web\WEB-INF/frontcontroller.xml</param-value>



an ever so slightly less complicated way....would be to define dir.web with ${file.seperator} instead of slashes....then you could drop the pathconvert.

also if you are constantly doing the xml.location token replacement, try using the <copy/> task's filtering attribute and define a global build file filter.

gl, Jim Fuller

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to