ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brown, Carlton" <Carlton.Br...@BellSouth.com>
Subject RE: How to use ANT as a command shell
Date Tue, 06 Dec 2005 16:01:50 GMT
> -----Original Message-----
> From: Michael Giroux [mailto:mlgiroux@gmail.com]
> Sent: Tuesday, December 06, 2005 10:18 AM
> To: Ant Users List
> Subject: How to use ANT as a command shell
> 
> I'm attempting to develop platform neutral launch scripts using ANT.
The
> product currently has bin/nt and bin/unix folders with shell scripts
> specific to each platform.  I would like to replace this with a single
bin
> folder containing ant scripts.
> 
> The main issue is that ANT treats command line args as target names.
>

Unless I'm misunderstanding your question:
 
> Is there any way to cause ANT to
> 1) always invoke the default target

Did <project name="MyProject" default="MyDefaultTarget"> not work for
you?

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

There are a number of ways to do this.  Did you try using
platform-specific property files with properties defining the
command-line args, and then specifying the correct file from an ant
command-line param?  

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.

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


Mime
View raw message