ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Fuller <jim.ful...@ruminate.co.uk>
Subject Re: directory paths
Date Fri, 04 Mar 2005 12:55:55 GMT
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message