ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Twiggs, Glenn" <>
Subject Ant2 requirements for cross-project dependencies
Date Wed, 21 Mar 2001 16:33:53 GMT
Here are a few requirements for Ant2 that, I think, will help make ant more
suitable for building software composed of many projects. These requirements
will help make dependencies between different projects explicit and coded
within the projects themselves.

My current implementation/hack of this is to make use of a "master"
buildfile which has a target defined for each "sub-project" buildfile. This
target lists the dependencies for the sub-project and then calls the
subproject using the "ant" task. The problem I have with this implementation
is it moves the declaration of dependencies out of the "sub-project" and
requires explicitly calling the sub-project build files.


Requirement 1: Allow a target to depend on a target which is in another
Requirement 2: Allow a target to reference properties defined in another

Here are example buildfiles illustrating a possible implementation of the
requirements. These buildfiles assume the addition of the following three

1) The XML namespace syntax is used by the "optional" project to reference
targets and properties in the "core" project.

2) The "core" project is included by using the "include-project" element and
referencing the buildfile containing the "core" project.

3) The property "buildfile.dir", used in the project element's basedir
attribute, indicates that the base directory of the project is the same as
the location of the project's buildfile. I've used this to ensure that files
are built in a well-known and stable location.

File core/build.xml:

<project name="core" basedir="${buildfile.dir}">
  <target name="init">
    <property name="classes.dir" location="core/classes" />

  <target name="compile" depends="init">
    <javac ... destdir="${classes.dir}" />

File optional/build.xml:

<project name="optional" basedir="${buildfile.dir}">
  <include-project buildfile="../core/build.xml" />

  <target name="compile" depends="core:compile">
    <javac ... >
        <pathelement location="${core:classes.dir}" />

I realize that this implementation has far-reaching consequences impacting
the way that properties and ant targets are currently scoped and referenced,
but I can ask for anything ... I just shouldn't expect to get it!

BTW, I've looked through the most recent "requested-features.txt" doc and
found the following features to be related to what I'm requesting...

* namespace support so different concerns can occupy different namespaces
  from ant (thus SAX2/JAXP1.1)

* allow facilities to build projects from multiple sources. ie CSS+xml
  or XSLT+ XML or Velocity+text or database or from inside jars or normal 
  build.xmls etc.

  allow the project tree to be built dynamically.

* make separate build files easy (ala AntFarm) and importing different
  projects a breeze

* support more control over the properties that are going to be passed
  to subprojects (modules)

* better subproject handling

  Whatever that means in detail.

* Ability to manage scopping of properties in general (ie


View raw message