Ant: Passing attributes to Build.xml

Critter on a previous post asked "if you can pass in attributes to the build.xml file?" From the Terminal this is as easy as adding another argument "-D".

Posted: 29-Jun-2007

View: 7374

Permalink: here

Comments

Nice one mate.

I've taken the old Model-Glue Ant script you had and modified it a bit.. I've downloaded the latest and placed it on my computer.. made these modification: @modelglueapplicationtemplate@ to all the necessary files..

so now I can call my build.xml and pass in the directory name where I want M-G to be built..

#1 Critter
29/Jun/07 12:00 PM

I also use the Ant input task with the addproperty attribute quite a bit. (http://ant.apache.org/manual/CoreTasks/input.html) If you use Eclipse to run your build files you get a nice prompt box to enter your property value.

#2 Nathan Mische
29/Jun/07 12:52 PM

My preference has always been to create a build.properties file and include that in my build.xml file. I don't have a sample handy or I'd include some syntax, but I tend to use this approach for all of my deployment scripts .

#3 Rob Wilkerson
06/Jul/07 4:13 PM