What about this:
<import name="webapp-reusable-targets" file="commonwebappproject.xml"/>
<target name="jar" overrides-target-of="webapp-reusable-targets">
I also like the idea of pre/post targets for targets and tasks, behaves
like extensions points (aspectj style) rather than overriding this way:
<target name="webdoclet-war" pre="web-war">
<webdoclet ... />
<target name="post-webdoclet-war" pre="web-war">
<echo>it tooks x seconds to run web-war</echo>
Let us import other build files, point to and depend to targets defined
there, override targets and pre/post targets/tasks and you really can
write reusable reusable build file pieces.
Ara.
> -----Original Message-----
> From: Nicola Ken Barozzi [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 09, 2002 10:00 PM
> To: Ant Developers List
> Subject: Re: Ant 2 et al.
>
>
> Erik Hatcher wrote:
> > ----- Original Message -----
> > From: "Nicola Ken Barozzi" <[EMAIL PROTECTED]>
> >
> >>IMHO it's better to use composition rather than inheritance, ie
compose
> >>common build parts in your builds, like Java use Java packages.
> >
> >
> > I'm not entirely convinced of this yet, but I still need to ponder
this
> > some.
> >
> > Example:
> > I want to "inherit" a common web app project and add, say, XDoclet
> > generation of web.xml.
>
> import file="commonwebappproject.xml"
> import file="xdocletgeneration.xml"
>
> >>It's more a uses-a relationship rather than a is-a one.
> >>
> >>With imports you can modularize your builds.
> >
> >
> > But I don't want to import all the pieces for every build. I want
to
> inject
> > something into the dependency graph of an already pre-defined build.
> How
> > would that play out with imports?
>
> Ah, "inject in the dependency graph" is a delicate point ;-)
>
> If you want to not import everything, make an intermediate
> buildfile that imports the single parts and have each of
> your projects import that.
>
> This means that each of your projects have access to the common build
> targets with a single import, and can create others via composition,
ie
> by creating new targets and calling the original ones via antcall or
> depends.
>
> You are not able to inject though a target in a defined place in the
> imported tree though.
> It's specialization, what Maven does by giving hooks as pre and post
> targets to existing ones.
>
> But this hides the dependency tree that is modifies.
> If it's pre-made but hidden it's ok, but if it's modified *and*
hidden,
> it hides what is happening and can bring to subtle errors.
>
> --
> Nicola Ken Barozzi [EMAIL PROTECTED]
> - verba volant, scripta manent -
> (discussions get forgotten, just code remains)
> ---------------------------------------------------------------------
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>