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.
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 *
4 * Name: is anything you want it to be, for this example its build-mg
5 * default: is the first target (method) to run
6 * basedir: is the base directory, this can be any local location
7 *
8 -->
9
10 <project name="build-mg" default="deploy" basedir=".">
11
12
13 <!--
14 *
15 * Description: Describes what the build file does
16 *
17 -->
18 <description>
19 Builds a new ModelGlue project
20 </description>
21
22
23 <!--
24 *
25 * The property tag is just setting a variable.
26 * name: variable name. You can reference this via ${xxxxx}
27 * value: variable value
28 *
29 -->
30 <property name="mgfolder" value="/Path2ModelGlueDirectory/ModelGlue/modelglueapplicationtemplate" />
31
32
33 <!--
34 *
35 * Target: In effect this is your method
36 * The next set of tags are self explanitory.
37 *
38 -->
39 <target name="deploy">
40 <copy todir="${basedir}">
41 <fileset dir="${mgfolder}"/>
42 </copy>
43 </target>
44
45
46 <!--
47 *
48 * Thats it
49 *
50 -->
51 </project>
2 <!--
3 *
4 * Name: is anything you want it to be, for this example its build-mg
5 * default: is the first target (method) to run
6 * basedir: is the base directory, this can be any local location
7 *
8 -->
9
10 <project name="build-mg" default="deploy" basedir=".">
11
12
13 <!--
14 *
15 * Description: Describes what the build file does
16 *
17 -->
18 <description>
19 Builds a new ModelGlue project
20 </description>
21
22
23 <!--
24 *
25 * The property tag is just setting a variable.
26 * name: variable name. You can reference this via ${xxxxx}
27 * value: variable value
28 *
29 -->
30 <property name="mgfolder" value="/Path2ModelGlueDirectory/ModelGlue/modelglueapplicationtemplate" />
31
32
33 <!--
34 *
35 * Target: In effect this is your method
36 * The next set of tags are self explanitory.
37 *
38 -->
39 <target name="deploy">
40 <copy todir="${basedir}">
41 <fileset dir="${mgfolder}"/>
42 </copy>
43 </target>
44
45
46 <!--
47 *
48 * Thats it
49 *
50 -->
51 </project>
TweetBacks
There are no comments for this entry.
[Add Comment] [Subscribe to Comments]