ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rolf Katzenberger <>
Subject Re: "overriding" a target
Date Sat, 05 Jan 2002 18:13:48 GMT
Hi Clint

On Fri, 4 Jan 2002 17:36:05 -0500 , "Combs, Clint"
<> wrote:

>My company is using ant for all our Java builds.  We have a primary build
>file, called common.xml, and all include files named project-name.xml
>include this file via a line like:
><!ENTITY include.commontasks SYSTEM "file:./common.xml">
>This works great, but I have a project where I'd like to extend the "clean"
>target that is found in common.xml.  In other words, I'd like to define the
>"clean" target in project-name.xml to do everything in common.xml, plus a
>few more things.  Obviously, I could define another target name which
>depends on clean, but that would break the overall build process, which
>calls clean automatically on each project.

How about the approach described below?



  <property name="" value="clean.commontasks" />

  <target name="clean">
    <antcall target="${}" />

  <!-- The common clean target: -->
  <target name="clean.commontasks">
    <echo message="Now executing commontasks clean..." />

The project build.xml:

  <?xml version="1.0"?>

  <!DOCTYPE project [<!ENTITY common SYSTEM "file:./common.xml">]>

  <project name="myproject" default="test" basedir=".">

    <!-- Comment this out and clean.commontasks will be called: -->
    <property name="" value="clean.myproject" />

    <target name="test" depends="clean" />
      <!-- The overriding clean target: -->
      <target name="clean.myproject">
        <antcall target="clean.commontasks" />
        <echo message="Now executing project clean..." />

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message