ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mathieu Champlon <m.champ...@free.fr>
Subject Re: Passing command line arguments to the "run" target??
Date Sun, 27 Aug 2006 03:26:38 GMT
johann.petrak@gmail.com a écrit :
>
> So I want to do something like
>  ant run -a -b -c
> which should result in "-a -b -c" to be passed to the <java> task.
> Next time I want to do
>  ant run -x a 12 23
> and now "-a a 12 23" should be used by the java task.
>
A property can be set from the command line, like this :
ant -Dmy.args="-a -b -c"

Then it can be used in the <java> task :
<java ...>
  <arg line="${my.args}"/>
</java>

If the command line format is important to you (because for example it's 
what your users are going to type) the most simple solution that comes 
to mind is to write a small script that formats its command line 
parameters into an call ant with a -D option.

I hope that helps.

MAT.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message