You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ja...@rzf.fin-nrw.de on 2004/02/04 07:15:42 UTC

RE: Any examples of how we can simplify ant build.xml with templa tes (?)

Without ever done that I would try that:

parent/build.xml
- facade for the major targets (build, test, compile...) using <subant>
  <project name="Masterbuild">
      <fileset id="children" dir="*/build.xml"/>
      <target name="compile">
          <subant target="compile">
              <fileset refid="children"/>
          </subant>   
      </target>
      <target name="test">
          <subant .../>
  ...

parent/template.xml
- define common used things
  - import property files
  - define new tasks: <taskdef>, <macrodef>, <presetdef>, <scriptdef>
  - define global targets

child/build.xml
- import the template.xml
- override targets, if needed (see "Target overriding" in import´s manual)
    class Super { void meth(); }     
    class Sub 
      extends Super {          -->  <import>
        void newMeth();        -->  <target>
        void meth() {
             super.meth();     -->  <antcall target="Super.meth"/>
        }
    } 


Jan


> -----Original Message-----
> From: Baz ¤Ñª° [mailto:sky_fox1@yahoo.com]
> Sent: Tuesday, February 03, 2004 8:28 PM
> To: ant-user@jakarta.apache.org
> Subject: Any examples of how we can simplify ant build.xml with
> templates (?)
> 
> 
> All,
> 
> I am sure that there are thousand solutions for this question. But, 
> I want to see if anyone can give actual ant build.xml samples for 
> simplifying multi layers projects. Meaning parent/build.xml, 
> child/build.xml.
> 
> How can I simplify them? Using <import> as one suggested and build 
> templates.xml with already definied targets in the top of the tree? 
> How can I implement it correctly? Other examples or solutions? 
> 
> Thanks
> 
> B.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Re: Any examples of how we can simplify ant build.xml with templa tes (?)

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Feb 4, 2004, at 1:15 AM, Jan.Materne@rzf.fin-nrw.de wrote:
> child/build.xml
> - import the template.xml
> - override targets, if needed (see "Target overriding" in import´s 
> manual)
>     class Super { void meth(); }
>     class Sub
>       extends Super {          -->  <import>
>         void newMeth();        -->  <target>
>         void meth() {
>              super.meth();     -->  <antcall target="Super.meth"/>
>         }
>     }

Is there a way to call "super" in this scenario without using <antcall>?

Another interesting trick is to define "abstract" targets in the super 
build which require implementation in the sub build.  So rather than 
overriding targets, I think I prefer to define pre abstract targets.

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org