ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <>
Subject Re: How to replace substring into property and get result into another property ?
Date Tue, 29 Aug 2006 14:41:46 GMT
--- Mathieu Champlon <> wrote:

> Willy Reinhardt a écrit :
> > Hi, 
> > I get a property value as : 
> >
> >
> > and would replace character "," by ";" or ":" 
> >
> > is a ant task can do that ? 

In this case, having a property value as described
above, it is pretty clear that the files described by
the property share a common root (probably the
project's basedir).  Deriving a path-like format is

Given property "foo":

<pathconvert property="bar">
    <fileset dir="${basedir}" includes="${foo}" />

property "bar" will contain the formatted path.  The
use of <fileset> assumes that the named files exist. 
If they may not, you could use

  <filelist dir="${basedir}" files="${foo}" />


Note that in either case, ${bar} will contain absolute
pathnames.  If this is a problem, you should be able
to get rid of the leading path with <pathconvert>'s
(older) nested <map> elements, or nested file
<mapper>s as detailed in the manual.

Finally, the fact that the files in this example are
jar files suggests that you may not actually need a
property to store the path.  If you are using e.g.
<java> or another Ant task that requires a classpath,
we have already seen how to build the path object from
your input property.


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message