ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Calling task in another xml file from main build file
Date Thu, 13 Dec 2007 06:10:20 GMT
You should be more precise with the terms "tasks" and "targets" ...

There are multiple options to call external defined collections of tasks:

1. <ant target> or <ant><target>
   Calls the specified (one or multiple) targets in another buildfile.
2. <subant target>
   Calls the specified target in multiple other buildfiles.
3. <import>
   Imports another buildfile, so that the targets defined their are now like
   the targets defined in your own buildfile.
       ant myownTarget
       ant importedTarget
4. xml includes
   Ok, just for completeness ...
5. <import> + <macrodef>
   You could define a new "task" as macro in an external file
       <project name="mymacro">
           <macrodef name="macro">...
       </project>
       <project name="myproject">
           <import name="mymacro.xml"/>
           <macro/>
       </project>
6. You could externalize scriptdefinitions in <script src> or <sriptdef src>
       hello.js:   
         self.log("Hello");
       build.xml:  
         <project>
             <script src="hello.js" language="javascript"/>
             <scriptdef name="hello" src="hello.js" language="javascript"/>
             <hello/>
         </project>


Jan



> -----Urspr√ľngliche Nachricht-----
> Von: Francisco Tolmasky [mailto:tolmasky@gmail.com] 
> Gesendet: Donnerstag, 13. Dezember 2007 00:31
> An: Ant Users List
> Betreff: Re: Calling task in another xml file from main build file
> 
> <ant file = "whatever.xml" target = "the_target" />
> 
> http://ant.apache.org/manual/CoreTasks/ant.html
> 
> Francisco
> 
> On Dec 12, 2007, at 3:25 PM, Z W wrote:
> 
> > Hi
> >
> > I have multiple tasks and I like to move a few tasks into another  
> > xml file.
> > What's the syntax to call another task in another xml file 
> from the  
> > original
> > buildfile ?
> > Eg:
> >
> >
> > <ant antfile="task_file.xml">
> >
> > <!-- how do I make a task call ? -->
> >
> > </ant>
> >
> >
> >
> > task_file.xml
> >
> > <project>
> >
> > <target name="test_hi">
> >
> > <echo message="hi" />
> >
> > </target>
> >
> > </project>
> >
> >
> >
> > Any example similar to this is appreciated also.
> >
> > Thanks
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 

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


Mime
View raw message