passing paremeters to ANT

R

rrothberg

i dont know anything about ANT and have been trying to work on a
solution by looking at our current build scripts and reading up on ANT
but haven't been able to find a solution yet.

basically I'm responsible for the CVS and BASH scripts for checking out
and compiling the code. the developers deal with the ANT and build.xml
files generally. what i want to is to pass the tag I've created with
CVS to the ANT script so that a developer can then take that tag and
build it into his java code so we know what particular CVS tag a
running application is based on.

however, i was asked to figure out how to modify the build.xml file
appropriately to at least assign to a variable the parameter i want to
pass from my BASH script.

the concept that BASH used of assigning parameters to variables (ie %1
%2, etc) doesn't appear to apply here. It almost looks like I need to
pass a variable name (property?) along with the actual variable.

Could someone perhaps give me a quick example of how I might pass
something like a variable of App20050625 and assign it to a name
(property?) of CVStag within the build.xml file?

I really appreciate any help. Thanks!
 
R

Raymond DeCampo

i dont know anything about ANT and have been trying to work on a
solution by looking at our current build scripts and reading up on ANT
but haven't been able to find a solution yet.

basically I'm responsible for the CVS and BASH scripts for checking out
and compiling the code. the developers deal with the ANT and build.xml
files generally. what i want to is to pass the tag I've created with
CVS to the ANT script so that a developer can then take that tag and
build it into his java code so we know what particular CVS tag a
running application is based on.

however, i was asked to figure out how to modify the build.xml file
appropriately to at least assign to a variable the parameter i want to
pass from my BASH script.

the concept that BASH used of assigning parameters to variables (ie %1
%2, etc) doesn't appear to apply here. It almost looks like I need to
pass a variable name (property?) along with the actual variable.

Could someone perhaps give me a quick example of how I might pass
something like a variable of App20050625 and assign it to a name
(property?) of CVStag within the build.xml file?

ant -DCVStag=App20050625 target1 target2 ...

Within the build.xml file, use ${CVStag} to get the value of the property.

Other possibilities include defining the property within the build.xml
file or in a properties file that ANT reads. These may not be
appropriate for your use however, unless there is some way for CVS to
embed the value in a file upon checkout and then you would be golden.

HTH,
Ray
 
R

rrothberg

thanks, i have no idea how they would take that and embed it into an
app, but that's their problem :). writing it out to a file is
extremely simple. CVS doesn't do it, but it's easy enough to do with
BASH.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top