I see this getting asked a lot. So here is how…

Create your build script like the following

<?xml version="1.0" encoding="UTF-8"?>
<project name="attrtest" basedir="." default="displayHello">

<property name=”attrValue1″ value=”” />
<property name=”attrValue2″ value=”” />

<target name=”displayHello”>
<echo message=”Hello ${attrValue1} ${attrValue2}!”/>
</target>

</project>

run it like the following

ant -DattrValue1=Saidul -DattrValue2=Islam

Advertisements