Roger,
I did actually take Glenn's advice this morning (thanks Glenn!) and modified
his XSL stylesheet example to redo my build file. However, the change made
my build file is IMHO not a good thing:
BEFORE:
<!-- AuctionManager target -->
<target name="AuctionManager.compile" depends="init,TXManager.interface">
<property name="ejb.basedir" value="com\auctionlogic\auction"/>
<property name="ejb.basename" value="AuctionManager"/>
<property name="ejb.includes" value="*.java"/>
<ant antfile="${include.dir}/ejb-build.xml" dir="."
target="ejb.compile"/>
</target>
<target name="AuctionManager.build" depends="init,AuctionManager.compile">
<property name="ejb.basedir" value="com\auctionlogic\auction"/>
<property name="ejb.basename" value="AuctionManager"/>
<ant antfile="${include.dir}/ejb-build.xml" dir="."
target="ejb.descriptor"/>
<ant antfile="${include.dir}/ejb-build.xml" dir="."
target="ejb.container"/></target>
AFTER:
<!-- AuctionManager target -->
<target name="AuctionManager.compile" depends="init,TXManager.interface">
<ant antfile="${include.dir}/ejb-build.xml" dir="."
target="ejb.compile">
<property name="ejb.basedir" value="com\auctionlogic\auction"/>
<property name="ejb.basename" value="AuctionManager"/>
<property name="ejb.includes" value="*.java"/>
</ant>
</target>
<target name="AuctionManager.build" depends="init,AuctionManager.compile">
<ant antfile="${include.dir}/ejb-build.xml" dir="."
target="ejb.descriptor">
<property name="ejb.basedir" value="com\auctionlogic\auction"/>
<property name="ejb.basename" value="AuctionManager"/>
</ant>
<ant antfile="${include.dir}/ejb-build.xml" dir="."
target="ejb.container">
<property name="ejb.basedir" value="com\auctionlogic\auction"/>
<property name="ejb.basename" value="AuctionManager"/>
</ant>
</target>
So you can see that nesting the properties in the <ant> tag potentially
creates more work for me from a maintenance standpoint because now I have
two sets of identical properties for each target. It's also more difficult
to read. Yes, its a Bad Thing.
Basically what I want is not necessarily mutable properties...I just need a
way to create variables so I can parameterize a reusable section of build
code. Yes, subroutines for Ant. Any suggestions?
BTW, the problem I see with using templated targets ala Jesse's patch is
that it would be difficult to define different "depends" for each different
target, no?
Ken