ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <>
Subject Re: Build file inclusion
Date Mon, 06 Jan 2003 15:57:11 GMT

Jessica P. Hekman wrote:
> On Sat, 4 Jan 2003, Steve Loughran wrote:
>>you can do inclusions today using XML includes -declare the entities in the
>>header of the build file, then insert them wherever you feel like.
>><?xml version="1.0"?>
>><!DOCTYPE project [
>>        <!ENTITY properties SYSTEM "file:xmls/properties.xml">
>>        <!ENTITY paths  SYSTEM "file:xmls/path_refs.xml">
>>        <!ENTITY taskdefs SYSTEM "file:xmls/taskdefs.xml">
>>        <!ENTITY taskdefs_post_compile SYSTEM
>>        <!ENTITY targets SYSTEM "file:xmls/targets.xml">
>><project name="buildTest" default="printEnv" basedir=".">
>>      &properties;
>>      &paths;
>>      &taskdefs;
>>      &taskdefs_post_compile;
>>      &targets;
> I hadn't thought of that, and it is a pretty good idea. I think in 
> practice the problem will be if we want to override a target (or property 
> or whatever) from the original build file. So if the original build file 
> contains a target called "clean" which deletes two directories, and in the 
> subproject's build file we want "clean" to delete only one of those 
> directories, we would want to be able to redefine the "clean" target. 
> Using the inclusion method described above, of course, you'd get a 
> "duplicate target" error. (Separating out targets which might be redefined 
> into separate entities could get really horrible really quickly.)
> Come to think of it, it seems likely that the <import> task mentioned in a 
> previous mail might have this problem as well. I'll try to check out of 
> CVS and test that, but if someone knows offhand, that would save me some 
> time.

Redefinition of targets is a use-case for <import>, so it works (at 
least it *should*).

You should also be able to call the previous version with the name:

so if you override a "mytarget" target from an imported project named 
"importedproject", you can call the old target with

  <antcall target="importedproject.mytarget"/ >

  or in a depends="" attribute

Nicola Ken Barozzi         
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)

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

View raw message