ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Murdoch <>
Subject Re: Object oriented builds
Date Sun, 23 Jun 2002 07:13:53 GMT
On Sun, 23 Jun 2002 16:36, wrote:
> Templates aren't the major hassle with build file reuse. The main one is
> property sharing and passing. Currently templates can be defined using
> build files and called using <ant>.
> What are the advantages of the template-def over this?

Probably the main advantage is that templates get expanded and executed in the 
current project scope, rather than spinning up a new project, so:

- The template can get and set properties and references in the current 
project (myrmidon treats properties and references as the same thing).  This 
addresses the property sharing and passing issue.

- Similarly, the template can, for example, define new tasks, import antlibs, 
install listeners, whatever, in the current project.

- Target dependency info is maintained.

- Lighter weight (no need to reparse a build file, or start up a new project).

Some other pluses:

- The template definition can be included in the build file.

- A bunch of templates can be bundled together in an antlib, and imported.  
So, potentially easier to distribute and install than a build file + <ant> 

- Template instantiations look just like regular tasks in the build file.  
This means you can change the template into a regular task without changing 
the build files that use it.

- Templates make use of the same namespace and aliasing goodness that tasks 

Some negatives:

- Templates currently can't be used to add targets to a project.  They have to 
be used as if they were tasks.  This means you couldn't have a template that 
expanded a high-level maven-esque project description into, say, a 'compile' 
target and a 'jar' target, and a 'test' target.  This might not end up being 
a problem, as you can use a transforming project builder and cross-project 
dependencies to achieve pretty much the same thing.

- Can't define the template as a stylesheet or templating script.  No real 
reason why not, just hasn't been wired up yet.


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

View raw message