ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Passing arguments.
Date Wed, 27 Jun 2001 06:46:57 GMT
Praveen C. <praveen@elixirtech.com> wrote:

> Can ant recognize and capture arguments
> in the command line.

Everything that doesn't start with a "-" will be interpreted as a
target name by Ant.  You want to pass in a property.

> For example:
> 
> # ant -buildfile build.xml execute a.java

ant -buildfile build.xml execute -Dfilename=a.java

and in your buildfile, wherever you wanted to say a.java or $1 or %1
or whatever, say ${filename}.  Use

<project name="dummy" default="echoparameter" basedir=".">
  <target name="echoparameter">
    <echo message="Parameter is ${filename}" />
  </target>
</project>

as a starting point.

Stefan

Mime
View raw message