Reputation: 53
How can we pass command line argument to ant target
for example I have target in build.xml defined as below
<target name="test">
<echo>Hello,</echo>
</target>
if I invoke ant as cmd>ant -buildfile build.xml test USERNAME
It should print echo as "Hello, USERNAME"
is it possible some way? Thanks in advance for help
Upvotes: 0
Views: 476
Reputation: 34135
ant -buildfile build.xml test USERNAME
would mean run the two targets, test
and USERNAME
(see Ant manual).
Instead, do ant -buildfile build.xml -Dname=USERNAME test
and
<target name="test">
<echo>Hello, ${name}</echo>
</target>
Upvotes: 0