1 | <?xml version="1.0"?> |
---|
2 | |
---|
3 | |
---|
4 | <!-- ====================================================================== |
---|
5 | Date: January 2010 |
---|
6 | |
---|
7 | Project: Struts 2 Coding Actions |
---|
8 | |
---|
9 | Author: Bruce Phillips |
---|
10 | ====================================================================== --> |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | <project name="Coding_Actions_Struts2_Ant" default="archive" basedir="."> |
---|
15 | |
---|
16 | <description> |
---|
17 | Example of using Struts 2 tags. |
---|
18 | </description> |
---|
19 | |
---|
20 | <property file="build.properties"/> |
---|
21 | |
---|
22 | |
---|
23 | |
---|
24 | <!-- ==================== Clean Target ==================================== --> |
---|
25 | |
---|
26 | <!-- |
---|
27 | The "clean" target deletes any previous "build" and "dist" directory, |
---|
28 | so that you can be ensured the application can be built from scratch. |
---|
29 | --> |
---|
30 | <target name="clean" description="Delete old build and dist directories"> |
---|
31 | <delete dir="${dist.home}"/> |
---|
32 | <delete dir="${build.home}"/> |
---|
33 | </target> |
---|
34 | |
---|
35 | <!-- ==================== Init Target ================================== --> |
---|
36 | |
---|
37 | <!-- |
---|
38 | |
---|
39 | The "init" target is used to create the "build" destination directory, |
---|
40 | Normally, this task is executed indirectly when needed. |
---|
41 | |
---|
42 | --> |
---|
43 | <target name="init" depends="clean" description="Create build directory"> |
---|
44 | |
---|
45 | <mkdir dir="${build.home}" /> |
---|
46 | |
---|
47 | </target> |
---|
48 | |
---|
49 | <!-- ==================== Compile Target ================================== --> |
---|
50 | |
---|
51 | <!-- |
---|
52 | |
---|
53 | The "compile" target transforms source files (from your "src" directory) |
---|
54 | into class files in the appropriate location in the build directory. |
---|
55 | This example assumes that you will be including your classes in an |
---|
56 | unpacked directory hierarchy under "/WEB-INF/classes". |
---|
57 | |
---|
58 | --> |
---|
59 | <target name="compile" depends="init" description="Compile Java sources"> |
---|
60 | |
---|
61 | |
---|
62 | <mkdir dir="${build.home}/WEB-INF/classes" /> |
---|
63 | |
---|
64 | <javac srcdir="${source.home}" |
---|
65 | destdir="${build.home}/WEB-INF/classes" |
---|
66 | debug="${compile.debug}" |
---|
67 | deprecation="${compile.deprecation}" |
---|
68 | optimize="${compile.optimize}" |
---|
69 | source="1.6" target="1.6"> |
---|
70 | |
---|
71 | <classpath> |
---|
72 | <path> |
---|
73 | <fileset dir="${lib.home}" /> |
---|
74 | <fileset dir="${lib.external}" /> |
---|
75 | </path> |
---|
76 | </classpath> |
---|
77 | |
---|
78 | </javac> |
---|
79 | |
---|
80 | </target> |
---|
81 | |
---|
82 | <!-- ==================== Build Target ================================== --> |
---|
83 | |
---|
84 | <!-- |
---|
85 | |
---|
86 | The "build" target copies all non class files to build directory |
---|
87 | |
---|
88 | --> |
---|
89 | |
---|
90 | <target name="build" depends="compile" description="Copies all non Java classes to build directoy"> |
---|
91 | <copy todir="${build.home}"> |
---|
92 | <fileset dir="${webapp.home}" excludes="SVN,**/*.class" /> |
---|
93 | </copy> |
---|
94 | <copy todir="${build.home}/WEB-INF/classes"> |
---|
95 | <fileset dir="${source.home}" excludes="SVN,**/*.java" /> |
---|
96 | </copy> |
---|
97 | </target> |
---|
98 | |
---|
99 | <!-- ==================== Archive Target ================================== --> |
---|
100 | |
---|
101 | <!-- |
---|
102 | |
---|
103 | The "archive" target create a binary archive of all files in build.home |
---|
104 | |
---|
105 | --> |
---|
106 | |
---|
107 | <target name="deploy-local" depends="build" description="Create binary archive of all files in dist.home and put in tomcat/webapps"> |
---|
108 | |
---|
109 | <mkdir dir="${dist.home}" /> |
---|
110 | |
---|
111 | <!-- Create application WAR file --> |
---|
112 | <jar jarfile="${dist.home}/${app.name}.war" |
---|
113 | basedir="${build.home}" /> |
---|
114 | |
---|
115 | <delete dir="${deploy.dir}/${app.name}" /> |
---|
116 | <delete dir="${deploy.dir}/${app.name}.war" /> |
---|
117 | <copy tofile="${deploy.dir}/${app.name}.war" file="${dist.home}/${app.name}.war"/> |
---|
118 | </target> |
---|
119 | |
---|
120 | <target name="archive" depends="build" description="Create binary archive of all files in dist.home"> |
---|
121 | |
---|
122 | <mkdir dir="${dist.home}" /> |
---|
123 | |
---|
124 | <!-- Create application WAR file --> |
---|
125 | <jar jarfile="${dist.home}/${app.name}.war" |
---|
126 | basedir="${build.home}" /> |
---|
127 | </target> |
---|
128 | |
---|
129 | |
---|
130 | |
---|
131 | </project> |
---|
132 | |
---|