ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Vernum <Tim.Ver...@macquarie.com.au>
Subject RE: Passing input parameters to build.xml
Date Tue, 13 Feb 2001 23:52:33 GMT

> Is there any way to pass parameters from build.sh to build.xml script? 
> (for example, build.sh accepts some parameters from the command line and has to pass
them to build.xml)

Yes.
You need to use the "-D" syntax, eg
	ant -D"some.property=$1" target

Then you could refer to it int the ant build.xml as
	${some.property}

If you don't know how many args you need you could do something like (untested)

ANT_DEFINES=""
ARG_NUM=1
while [ $# -ge 1 ]
do
	ANT_DEFINES="${ANT_DEFINES} -Darg${ARG_NUM}=$1"
	shift
	let ARG_NUM=$ARGNUM+1
done

ant ${ANT_DEFINES}

But then you have the problem of working out how to deal with them in ant.


Mime
View raw message