ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <j_a_fernan...@yahoo.com>
Subject Re: [ANT2] To <projectref> or not to <projectref>
Date Tue, 06 Nov 2001 12:56:14 GMT
From: "Tim Dawson" <tdawson@wamnet.com>

> > I think these are valid questions to ask. Or at least to put 
> > on the table so that
> > we can examine any unintended consequences of the decisions 
> > that are made.
> 
> I certainly think it will lead to easier to understand build
> files. Another use case is jakarta-taglibs... just take a minute
> to look at the way that 20+ projects inherit the same build.xml
> through an XML import.  The inheritance is really ugly, because
> Ant 1.x doesn't provide a good way to do it.
> 

I am very glad you point to those examples because they are a 
perfect example of the kind of build that I had in mind. 
Here is how you would do it:

<?xml version="1.0"?>

<project name="dbtags" default="main" extends="../common.xml" >

  <!-- create this file to store the locations of your dependant jars -->
  <property file="../build.properties"/>
  <property name="classpath" value="${servlet.jar}:${jdbc2_0-stdext.jar}"/>

  <target name="checkRequirements.pre">
    <antcall target="checkRequiredFile">
       <param name="file" value="${jdbc2_0-stdext.jar}"/>
       <param name="fail.message"               value="a jar file containing the jdbc2_0-stdext
classes is required to compile the dbtags taglib. please define the property jdbc2_0-stdext.jar
in your build.properties file and ensure that the file exists"/>
    </antcall>
  </target>
</project>

The project inherits most of its definitions from "../common.xml" (which is found using ANT
file rules using ${basedir} and such).In common.xml you define the the following targets:
    <target name="checkRequirements.pre"/>    <target name="checkRequirements.post"/>
which are overloaded by the definition presented here. I think it provides a simple and clear
way to look at the build file. 
> Users can always create spaghetti, whether its in one build file> or many (through
the xml import).  The best we can do is make it> easy to do "good" things.> 
This is very true, and exactly what I am trying to present here.
Jose Alberto



--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message