ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <>
Subject Re: Why use an init target ?
Date Wed, 24 Oct 2001 13:39:29 GMT
Wilson, Bruce wrote:

> I've seen many example Ant build files that define an <init> target to
> define common properties within;

At one stage (what is now known as version 0.3.1 - before the first 
official Ant release) Ant required such a construction to initialise 
properties which were not allowed to occur outside of tasks. I think the 
tomcat buildfiles had this structure and they have been copied a lot. 
Since they continued to work when properties were allowed, nobody 
bothered to change them.

It is also a fact that many people prefer the regularity of not having 
operations outside of tasks.

The other reason you may have an init task is to do things which remain 
unsupported outside of tasks. This might include running <mkdir> to 
create some directory needed by all build targets, setting timestamps, 
etc. So, the pattern itself, while not necessary for properties is still 
very much valid.

There is some debate going on in ant-dev know about what may or may not be permissible where
in future versions of Ant. 


View raw message