ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Mark Bram" <relaxed...@optusnet.com.au>
Subject Re: argument to ant at command line
Date Wed, 07 Jul 2004 02:14:18 GMT
Hi Sri,

> Can we pass a filename as an argument to ant instead of specifying it as  
> a
> arg value in <java> task.
>
> eg:
> ant build.xml filename
>

You can set properties on the command line which you can use inside an ant  
file. Like this:

<project name="Test" default="printArg" basedir=".">
    <target name="printArg">
       <echo>
          Filename arg: ${fileName}
       </echo>
    </target>
</project>

And I run it in this fashion:

$ant -DfileName=pop
Buildfile: build.xml

printArg:
      [echo]
      [echo]       Filename arg: pop
      [echo]

BUILD SUCCESSFUL
Total time: 3 seconds


Rob
:)


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


Mime
View raw message