You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stephane <s....@videotron.ca> on 2000/12/02 18:05:31 UTC

Parameters for tasks.

Hello all,

is there a way to pass arguments to ant tasks ?
It would be pretty nice for exemple
if you want to give args to a "run" target to give them on the command
line
of ant instead of creating many different targets for each different
tasks.

Thanks in advance,
 and excuse me if i ask stupid questions,
 i am a yound user of ant, and yet mad of it.

What a software you made !



RE: Parameters for tasks.

Posted by Conor MacNeill <co...@m64.com>.
Stephane,

Oops... mind not on job. You are right. Access it as ${test.param}

Conor


> -----Original Message-----
> From: steff [mailto:steff]On Behalf Of Stephane
> Sent: Sunday, 3 December 2000 15:28
> To: ant-dev@jakarta.apache.org
> Subject: Re: Parameters for tasks.
> 
> 
> Hello Conor,
> 
> your explanation sounds great but I am a bit confused :
> 
> If you say
> ant -Dtest.param=1 target
> 
> Do you access ${ant.target}
> or ${test.param} ??
> 
> for the latter, it seems rather intuitive, but the former one 
> is rather odd
> .
> What would be the value of ${ant.target } ?
> 
> Thanks Conor,
>   your answer helped me anyway (I'll test it soon)
> 
> 
> 
> Conor MacNeill wrote:
> 
> > Stephane,
> >
> > You can define properties on the command line which you can 
> then use as
> > attribute values in your ant tasks.
> >
> > So, something like this
> >
> > ant -Dtest.param=1 target
> >
> > and then use ${ant.target} to access the value.
> >
> > Conor
> >
> > > -----Original Message-----
> > > From: steff [mailto:steff]On Behalf Of Stephane
> > > Sent: Sunday, 3 December 2000 4:06
> > > To: ant-dev@jakarta.apache.org
> > > Subject: Parameters for tasks.
> > >
> > >
> > > Hello all,
> > >
> > > is there a way to pass arguments to ant tasks ?
> > > It would be pretty nice for exemple
> > > if you want to give args to a "run" target to give them 
> on the command
> > > line
> > > of ant instead of creating many different targets for 
> each different
> > > tasks.
> > >
> > > Thanks in advance,
> > >  and excuse me if i ask stupid questions,
> > >  i am a yound user of ant, and yet mad of it.
> > >
> > > What a software you made !
> > >
> > >
> > >
> 

Re: Parameters for tasks.

Posted by Stephane <s....@videotron.ca>.
Hello Conor,

your explanation sounds great but I am a bit confused :

If you say
ant -Dtest.param=1 target

Do you access ${ant.target}
or ${test.param} ??

for the latter, it seems rather intuitive, but the former one is rather odd
.
What would be the value of ${ant.target } ?

Thanks Conor,
  your answer helped me anyway (I'll test it soon)



Conor MacNeill wrote:

> Stephane,
>
> You can define properties on the command line which you can then use as
> attribute values in your ant tasks.
>
> So, something like this
>
> ant -Dtest.param=1 target
>
> and then use ${ant.target} to access the value.
>
> Conor
>
> > -----Original Message-----
> > From: steff [mailto:steff]On Behalf Of Stephane
> > Sent: Sunday, 3 December 2000 4:06
> > To: ant-dev@jakarta.apache.org
> > Subject: Parameters for tasks.
> >
> >
> > Hello all,
> >
> > is there a way to pass arguments to ant tasks ?
> > It would be pretty nice for exemple
> > if you want to give args to a "run" target to give them on the command
> > line
> > of ant instead of creating many different targets for each different
> > tasks.
> >
> > Thanks in advance,
> >  and excuse me if i ask stupid questions,
> >  i am a yound user of ant, and yet mad of it.
> >
> > What a software you made !
> >
> >
> >


RE: Parameters for tasks.

Posted by Conor MacNeill <co...@m64.com>.
Stephane,

You can define properties on the command line which you can then use as
attribute values in your ant tasks.

So, something like this

ant -Dtest.param=1 target

and then use ${ant.target} to access the value.

Conor

> -----Original Message-----
> From: steff [mailto:steff]On Behalf Of Stephane
> Sent: Sunday, 3 December 2000 4:06
> To: ant-dev@jakarta.apache.org
> Subject: Parameters for tasks.
>
>
> Hello all,
>
> is there a way to pass arguments to ant tasks ?
> It would be pretty nice for exemple
> if you want to give args to a "run" target to give them on the command
> line
> of ant instead of creating many different targets for each different
> tasks.
>
> Thanks in advance,
>  and excuse me if i ask stupid questions,
>  i am a yound user of ant, and yet mad of it.
>
> What a software you made !
>
>
>