We use ANT in the way you described-- with a cascading model. We have a
project that contains many sub-projects. We built a build_<projname>.xml
file in the appropriate directories for each sub-project. Then, at the
main root of the project, we use a build.xml file. This file uses the
<ant> command. Consider this ficticious example:
<project name="Foo" default="main" basedir=".">
<!-- =================================================================== -->
<!-- Main target will compile all dependencies -->
<!-- =================================================================== -->
<target name="main">
<echo message="Building Apple..."/>
<ant antfile="build_apple.xml"/>
<echo message="Building Pear"/>
<ant antfile="build_pear.xml"/>
<echo message="Build Orange"/>
<ant antfile="build_orange.xml"/>
<echo message="Deploying to Jaguar CTS..."/>
<ant antfile="jagdeploy.xml"/>
</target>
</project>
In this way, I can use ant -buildfile build_orange.xml if I only want to build my
Orange sub-project, or go up one directory level and just issue ant
if I want to build everything.
HTH
--
Jason Weiss
Principal Architect
Sybase eBusiness Division
"Baldry, Scot M" <[EMAIL PROTECTED]> on 04/20/2001 05:55:19 AM
Please respond to [EMAIL PROTECTED]
To: "'[EMAIL PROTECTED]'"
<[EMAIL PROTECTED]>
cc: (bcc: Jason Weiss/SYBASE)
Subject: Includes within ANT
I think I may have found a deficiency in ANT - in the old days of Unix
Makefiles it was common to structure Makefiles in such a way that you would
"include" various targets and attributes for use within other Makefiles. I
can't seem to find a way to do this within ANT (the ant task is not quite
what I am looking for). This is best described with an example:
1. Imagine I have a large source tree that contains several "products" or
"deliverables"
i.e. com.mycompany.common
com.mycompany.productA
com.mycompany.productB
2. At any point I may want to build an individual product or the entire
source tree (containing all products and common code).
3. All my source is dependant upon several pieces of 3rd party supplied
software i.e. BEA Weblogic, JUnit etc etc. This 3rd party software is
typically supplied in jar only form and is therefore is not found within
the
current source tree - instead it is usually stored on a central file
system.
4. To build the entire tree I would like to use a cascading makefile
approach - for example a build.xml will exist at the "com" level that will
pass control to build.xml at the "mycompany" and so on. This will enable me
to use "ant all" at com to build the whole tree or "ant all" at any
sub-package to build everything below the current package.
5. I don't want every build.xml file to contain hard-coded references to
the
infrastructure - for example:
<property name="infradrive" value="k:/infra_v1_1_2" />
<property name="WeblogicVer" value="5.1.0" />
<property name="BEA Dir" value="BEAProducts" />
instead I would like to include something like "infra.xml" within every
build file - this will ensure that the entire tree build with consistent
infrastructure. Short of writing my own task I can't see how I can achieve
this. The "ant" task seems to assume things work the other way round - I
will call all targets from a master build.xml script and the environment
will be exported into the sub projects.
Does anyone have any ideas?
Many Thanks
Scot