ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <>
Subject Re: Filter on copy with directory contents
Date Fri, 22 Feb 2008 01:41:56 GMT
Well, the @REPLACE@ could be handled by a <filterchain> inside a copy.
The tricky part is finding the value for ${replacing}.

You might be able to do something with the AntContrib <PropertyRegex>
task. This can take a property and munge it.

Let's say you do something like this:

<path id="replaceme">
    <fileset dir="${replace.dir}">
        <include name="*.jar"/>

<property name="replace.string" refid="replaceme"/>

This will give you ${replace.string} = "foo.jar:bar.jar:fobar.jar"

Not what you want, but then you can use <propertyregex>


That will give you ${munge.replace} =

Then, we need to add a prefix and suffix:

<property name="munge.replace2"

It's all on a single line and not separate lines, but XML doesn't care.

<copy toDir="${dest.dir}">
  <fileset dir="${src.dir}">
    <include name="*.jar">

Haven't tested it, but something like that should work.

On Wed, Feb 20, 2008 at 4:20 PM, Paul J. Lucas <> wrote:
> Given a file that contains:
>         @REPLACEME@
>  I want to use <copy> to copy the file and replace @REPLACEME@ with
>  contents like:
>         <string>foo.jar</string>
>         <string>bar.jar</string>
>         ...
>  where "foo" and "bar" are the names of the file(s) in a particular
>  directory that match a certain pattern (in this case *.jar).
>  Is there a way to do that?  I've read the docs but the answer isn't
>  all that obvious.  Thanks.
>  - Paul
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail:
>  For additional commands, e-mail:

David Weintraub

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

View raw message