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