-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
135 lines (112 loc) · 3.7 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<project name="Ant Project" default="run">
<!-- define common filename and directories -->
<property name="bin_dir" value="./bin" />
<property name="src_dir" value="./src" />
<property name="lib_dir" value="./lib" />
<property name="test_report" value="./reports" />
<property name="doc_dir" value="./docs" />
<property name="client_classname" value="com.nk2164.client.SpringClient" />
<property name="dist_dir" value="./dist" />
<property name="warfile" value="mywebapp" />
<property name="html_dir" value="./web" />
<property name="webinf_dir" value="./WEB-INF" />
<property name="tomcat_dir" value="../tomcat/webapps" />
<path id="compiler_path">
<fileset dir="${lib_dir}">
<include name="*.jar" />
<exclude name="*.txt" />
</fileset>
</path>
<path id="runtime_path">
<path refid="compiler_path" />
<pathelement location="${bin_dir}" />
</path>
<!-- delete any generated resources -->
<target name="clean">
<delete dir="${bin_dir}" />
<delete dir="${test_report}" />
<delete dir="${doc_dir}" />
<delete dir="${dist_dir}" />
</target>
<!-- recreate the generated directories -->
<target name="create_directories" depends="clean">
<mkdir dir="${bin_dir}" />
<mkdir dir="${test_report}" />
<mkdir dir="${doc_dir}" />
<mkdir dir="${dist_dir}" />
</target>
<!-- Compile all of the java -->
<target name="compile" depends="create_directories">
<javac srcdir="${src_dir}" destdir="${bin_dir}" includeantruntime="false" debug="true">
<classpath refid="compiler_path" />
</javac>
<copy todir="${bin_dir}">
<fileset dir="${src_dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<!-- Run all of junit tests -->
<target name="run_tests" depends="compile">
<junit printsummary="on" failureproperty="junit.failure">
<classpath refid="runtime_path" />
<batchtest todir="${test_report}">
<formatter type="xml" />
<fileset dir="${src_dir}">
<include name="**/*Test*.java" />
</fileset>
</batchtest>
</junit>
<!-- Generat a test report -->
<junitreport todir="${test_report}">
<fileset dir="${test_report}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${test_report}" />
</junitreport>
<!-- After the reports are generated, add the below step -->
<fail if="junit.failure" message="Some Junit Tests have failed." />
</target>
<!-- Generate a javadocs -->
<target name="generate_docs" depends="compile">
<javadoc destdir="${doc_dir}">
<packageset dir="${src_dir}">
<include name="com/**" />
</packageset>
</javadoc>
</target>
<!-- Copy application.xml and log4j.properties to bin dir & run application -->
<target name="run" depends="generate_docs , run_tests">
<copy todir="${bin_dir}">
<fileset dir="${src_dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
<java classname="${client_classname}">
<classpath>
<path refid="runtime_path" />
</classpath>
</java>
</target>
<target name="deploy" depends="compile" >
<war destfile="${dist_dir}/${warfile}.war" webxml="web.xml">
<fileset dir="${html_dir}" />
<lib dir="${lib_dir}" >
<exclude name="servlet-api.jar"/>
</lib>
<classes dir="${bin_dir}" />
<classes dir="${webinf_dir}">
<include name="**/*.xml" />
<include name="**/*.properties"/>
</classes>
<webinf dir="${webinf_dir}" >
<exclude name="**/*.properties"/>
</webinf>
<webinf dir="${src_dir}">
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</webinf>
</war>
<copy file="${dist_dir}/${warfile}.war" todir="${tomcat_dir}"></copy>
</target>
</project>