ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <>
Subject Re: Calling targets and passing parms?!
Date Mon, 17 Dec 2007 22:38:08 GMT
Not sure if this is what you're looking for, but you can pass in
properties by using the -D flag:

ant -Dlabel=Release_2007_12_01_001 -f mybuild target

The ${label} parameter becomes set to "Release_2007_12_01_001" when
the build script is executed. Even better, it cannot be reset via a
<parameter> task. That means you could have a default value defined in
your build file, and then have the command line value over ride it.

To do a replace on a copy use the "filter" ability of the <copy> task:

 <copy todir="${releaseDir}">
    <fileset dir="${buildDir}"/>
    <filterset begintoken="@" endtoken="@">
        <filter token="label"  value="${label}"/>

That will replace all instances of "@label@" in the files with the
value of ${label}. I believe you can have multiple <filter> parameters
inside the <filterset>.

As I said before, you should set a default inside the build file, so
if you don't provide a command line value, it will still have some
sort of value.

On Dec 17, 2007 4:42 PM, jdepaul <> wrote:
> Need to call an ANT target from a UNIX shell script and pass the parameter to
> it - like a Build TAG name:  so from within the shell script, I'd like to
> issue something like this:  ant -f mybuild.xml  Release_2007_12_01_001 - how
> could I pass a parm as input parm to a script so ANT could do some variable
> replacements for some of the files that get copied/filtered during the build
> - what's the best way to do that?!
> Thanks,
> James
> --
> View this message in context:
> Sent from the Ant - Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

David Weintraub

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

View raw message