Ant basics: Copying directories

Thanks to Eclipse making Ant so simple to use I've got it doing a few tasks for me. Well I thought I'd show how simple it is to use. Below is a simple Ant build.xml that I use to copy the ModelGlueAppliactionTemplate files over to a new project. In a nutshell it copies a bunch of files and directories from one location into the location the build.xml was ran from.

<?xml version="1.0" encoding="UTF-8"?>
<!--
*
* Name: is anything you want it to be, for this example its build-mg
* default: is the first target (method) to run
* basedir: is the base directory, this can be any local location
*
-->

<project name="build-mg" default="deploy" basedir=".">

   
   <!--
   *
   * Description: Describes what the build file does
   *
   -->

   <description>
Builds a new ModelGlue project
</description>

   
   <!--
   *
   * The property tag is just setting a variable.
   * name: variable name. You can reference this via ${xxxxx}
   * value: variable value
   *
   -->
   
<property name="mgfolder" value="/Path2ModelGlueDirectory/ModelGlue/modelglueapplicationtemplate" />

   
   <!--
   *
   * Target: In effect this is your method
   * The next set of tags are self explanitory.
   *   
   -->

   <target name="deploy">
    <copy todir="${basedir}">
    <fileset dir="${mgfolder}"/>
    </copy>         
   </target>

   
      <!--
      *
      * Thats it
      *
      -->

</project>

Comments (0) Print Send del.icio.us Digg It! Linking Blogs

3031 Views | Posted At : November 7, 2006 3:10 PM | Posted By : Andy Jarrett
Related Categories: model-glue, Ant

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)