You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Andrew n marshall <An...@mail.com> on 2008/03/05 14:46:15 UTC

Import task defined in other build file?

Is it possible to define a task in one ant build file, but use it in 
another?  For example, I want to have a single build file that contains 
the properties and tasks to download a copy of svnant and define its 
tasks.  Then I want to call that ant file's define_svn_task target from 
another file (which works) and call an <svn ../> task, like this:

  <ant antfile="svnant.xml" target="define_svn_task"/><!-- which calls taskdef -->
  <svn>
    <checkout url="${cpptasks.svn}" destPath="${cpptasks.dir}" />
  </svn>

Thus, I can copy this svnant.xml to several projects and repositories 
without having to edit out project specific details or dig for svnant 
attributes like the download URL or install directory.

When I tried this, the define_svn_task target succeeded, but it "failed 
to create task or type svn" in the next line.

Can someone provide an example of how to do this properly?


Anm

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


Re: Import task defined in other build file?

Posted by Peter Reilly <pe...@gmail.com>.
Use <import> and not <ant>

Peter

On Wed, Mar 5, 2008 at 1:46 PM, Andrew n marshall
<An...@mail.com> wrote:
>
>  Is it possible to define a task in one ant build file, but use it in
>  another?  For example, I want to have a single build file that contains
>  the properties and tasks to download a copy of svnant and define its
>  tasks.  Then I want to call that ant file's define_svn_task target from
>  another file (which works) and call an <svn ../> task, like this:
>
>   <ant antfile="svnant.xml" target="define_svn_task"/><!-- which calls taskdef -->
>   <svn>
>     <checkout url="${cpptasks.svn}" destPath="${cpptasks.dir}" />
>   </svn>
>
>  Thus, I can copy this svnant.xml to several projects and repositories
>  without having to edit out project specific details or dig for svnant
>  attributes like the download URL or install directory.
>
>  When I tried this, the define_svn_task target succeeded, but it "failed
>  to create task or type svn" in the next line.
>
>  Can someone provide an example of how to do this properly?
>
>
>  Anm
>
>  ---------------------------------------------------------------------
>  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