ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weller <dgwel...@yahoo.com>
Subject RE: Including other antfiles
Date Thu, 10 Aug 2000 16:56:15 GMT

--- Steve Sonntag <VTAG@novell.com> wrote:
> One side effect of this behavior is that all properties are passed
> to subordinate ant files when one uses the ant task.  This means
> that it is a nice way to pass common properties to all subordinate
> ant files, but it also means that if there are properties that must be unique
> for each ant file that new names must be invented for the property in each
> subordinate ant file because the property set in the superior ant file cannot
> be overridden.
> 

Um, no.  I thought this too (this is really a FAQ :-).

here's how you get around it(this is from my "Ant for Mortals" document -- no,
I haven't released it yet; no, I don't know when I will; but yes, Real Soon Now
:-)  
(let's assume this buildfile is called "this.xml")
<project name="adv_ant" default="common" basedir=".">
  <property name="first" value="bob"/>
  <property name="second" value="fred"/>
  <target name="common">
	<ant antfile="that.xml" dir="com/common">
		<property name="first" value="common"/>
		<property name="second" value="util"/>
    </ant>
  </target>

The "first" and "second" properties are now overridden.  In fact, you could
modify the "ant" task to call the same buildfile!

  <target name="common">
	<ant antfile="this.xml" dir=".">
             <!-- calls this same buildfile, but new property values! -->
		<property name="first" value="common"/>
		<property name="second" value="util"/>
    </ant>
  </target>


__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

Mime
View raw message