ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: How to use ANT as a command shell
Date Wed, 07 Dec 2005 05:43:15 GMT
>> Is there any way to cause ANT to
>> 1) always invoke the default target

You could specify a _default_ target since early versions of Ant
(in former time you has to specify the default attribute of project).
This target is performed, if you dont specify an alternative while
invocation.

If you want to execute some tasks undependent of the target, since
Ant 1.6.0 you could specify the tasks outside of targets (directly
under project).




>> 2) make the command line args available as a set of 
>properties or some form of enumeration

a) use a wrapper to pass the arguments as properties
b) patch Ant

I think Ant 1.7 will have the path :-)


Hhhm ... I think we have discussed exactly this only a few days (maybe 2 weeks)
earlier on this list .... you dont had have a look? You should - and you´ll 
find some nice links ...


>For example, (untested, defensive checks not included), if you 
>had a property file called sunos.properties with a line like this:
>copy.command=/bin/cp
>
>and your build file lines like:
><property file=${platform}.properties
><exec executable=${copy.command}/>
>
>then you could invoke your build file like:
>ant -Dplatform=sunos
>
>and the correct copy command would get resolved.


dont forget
  <import file="definitions.${platform}.xml"/>

you could do <taskdef>, <macrodef>, <presetdef>s there.
E.g. invocation of the browser ...



But anyway - Ant was not designed for that, so you´ll have to hack
a little bit (the buildfile).

(pssst: I used Ant as a download manager and a zip tool ;-)


Jan

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


Mime
View raw message