forked from PASTAplus/DataPortal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
184 lines (166 loc) · 6.94 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="deploy" name="DataPortal">
<!-- Properties files -->
<property file="build.properties" />
<property file="./WebRoot/WEB-INF/conf/dataportal.properties" />
<!-- Properties for building and deploying -->
<property name="build.dir" location="build" />
<property name="src.dir" value="src" />
<property name="web.dir" value="WebRoot" />
<property name="classes.dir" value="${web.dir}/WEB-INF/classes" />
<property name="conf.dir" value="${web.dir}/WEB-INF/conf" />
<property name="web.lib.dir" value="${web.dir}/WEB-INF/lib" />
<property name="webapp.name" value="nis" />
<property name="war.name" value="${webapp.name}.war" />
<property name="deploy.dir" value="${tomcat.home}/webapps" />
<property name="doc.dir" value="documents" />
<property name="api.dir" value="${doc.dir}/web-service-api" />
<property name="javadoc.dir" location="${doc.dir}/javadoc" />
<property name="common.code.dir" value="../common" />
<property name="common.jar.dir" value="${common.code.dir}/build/jar" />
<property name="doc.util.dir" value="../doc-util" />
<property name="source.files.to.copy" value="**/*.properties,**/*.xml" />
<!-- Properties for JUnit testing -->
<property name="test.dir" location="${build.dir}/test" />
<property name="test.classes.dir" location="${test.dir}/classes" />
<property name="test.data.dir" location="${test.dir}/data" />
<property name="test.reports.dir" location="${test.dir}/reports" />
<property name="test.coverage.dir" location="${test.dir}/coverage" />
<!-- Prepare needed directories files -->
<target name="prepare">
<!-- Make a data directory that holds data files for desktop uploads -->
<mkdir dir="${web.dir}/data" />
</target>
<!-- Copy log4j.properties.template to log4j.properties if the latter is missing -->
<target name="check-log4j-exists" unless="is-common-code">
<condition property="log4j-is-missing">
<not>
<available file="${conf.dir}/log4j.properties" />
</not>
</condition>
</target>
<target name="copylog4j" depends="check-log4j-exists" if="log4j-is-missing">
<copy file="${conf.dir}/log4j.properties.template" tofile="${conf.dir}/log4j.properties" preservelastmodified="true" verbose="true" filtering="no" />
</target>
<!-- Path for compiling the source code -->
<path id="compile.classpath">
<fileset dir="${web.lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${tomcat.lib}">
<include name="servlet*.jar" />
</fileset>
<pathelement path="${web.dir}/WEB-INF" />
</path>
<!-- Path for compiling the JUnit test code -->
<path id="test.compile.classpath">
<path refid="compile.classpath" />
<pathelement location="${classes.dir}" />
</path>
<!-- Path for executing the JUnit test code -->
<path id="test.classpath">
<path refid="test.compile.classpath" />
<pathelement location="${test.classes.dir}" />
</path>
<target name="clean" description="Deletes compiled classes">
<echo>Cleaning build and classes directories: ${basedir}/${classes.dir}</echo>
<delete dir="${build.dir}" />
<delete includeemptydirs="true">
<fileset dir="${classes.dir}" includes="**/*" />
</delete>
</target>
<target name="compile" depends="prepare,copylog4j" description="Compiles all Java source files">
<mkdir dir="${classes.dir}" />
<javac destdir="${classes.dir}" debug="true" deprecation="true" failonerror="true" optimize="false" includeantruntime="false">
<src path="${src.dir}" />
<classpath refid="compile.classpath" />
</javac>
<copy todir="${classes.dir}">
<fileset dir="${src.dir}" includes="${source.files.to.copy}" />
</copy>
</target>
<!-- Cleans and initializes the JUnit test directories -->
<target name="test-init">
<mkdir dir="${test.classes.dir}" />
<delete dir="${test.data.dir}" />
<delete dir="${test.reports.dir}" />
<mkdir dir="${test.data.dir}" />
<mkdir dir="${test.reports.dir}" />
</target>
<target name="test-compile" depends="compile,test-init" description="Compiles all JUnit test files">
<javac destdir="${test.classes.dir}" debug="true" srcdir="test">
<classpath refid="test.compile.classpath" />
</javac>
<copy todir="${test.classes.dir}">
<fileset dir="test" includes="${source.files.to.copy}" />
</copy>
</target>
<target name="test" depends="test-compile" description="Executes the JUnit test suites">
<junit printsummary="false" haltonfailure="false" errorProperty="test.failed" failureProperty="test.failed" fork="true">
<jvmarg value="-Duser.dir=${basedir}" />
<formatter type="brief" usefile="false" />
<formatter type="xml" />
<classpath refid="test.classpath" />
<test name="${testcase}" todir="${test.data.dir}" if="testcase" />
<batchtest fork="yes" todir="${test.data.dir}" unless="testcase">
<fileset dir="test">
<include name="**/*Test*.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.data.dir}">
<fileset dir="${test.data.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${test.reports.dir}" />
</junitreport>
<fail if="test.failed">
One or more JUnit tests failed or had errors.
Check ${test.reports.dir}.
</fail>
</target>
<target name="war" depends="compile" description="Creates a .war file">
<mkdir dir="${build.dir}" />
<war basedir="${web.dir}" destfile="${build.dir}/${war.name}" webxml="${web.dir}/WEB-INF/web.xml">
<include name="demo/**" />
<include name="docs/**" />
<include name="xsl/**" />
<exclude name="WEB-INF/**" />
<webinf dir="${web.dir}/WEB-INF/">
<include name="**/*.*" />
<exclude name="**/.svn*" />
<exclude name="**/.git*" />
<exclude name="**/.#*" />
</webinf>
<fileset dir="${web.dir}">
<include name="**/robots.txt" />
<include name="**/*.js" />
<include name="**/*.jsp" />
<include name="**/*.html" />
<include name="**/*.css" />
<include name="**/*.png" />
<include name="**/*.jpg" />
<include name="**/*.gif" />
<include name="**/*.ico" />
<include name="**/*.xml" />
<include name="data" />
</fileset>
</war>
</target>
<target name="deploy" depends="war" description="Deploys the web application to Tomcat (default target)">
<copy file="${build.dir}/${war.name}" todir="${deploy.dir}" preservelastmodified="true" verbose="true" filtering="no" />
</target>
<target name="javadoc" description="Generates Javadoc HTML" depends="compile">
<delete dir="${javadoc.dir}" />
<javadoc sourcepath="${src.dir}" classpathref="compile.classpath" destdir="${javadoc.dir}">
<link href="http://download.oracle.com/javase/8/docs/api/" />
<link href="http://jersey.java.net/nonav/apidocs/1.5/jersey/" />
<link href="${basedir}/${common.code.dir}/documents/javadoc/" />
<link href="http://www.unboundid.com/products/ldap-sdk/docs/javadoc" />
<link href="http://jaxb.java.net/nonav/2.2.3u1/docs/api/" />
</javadoc>
</target>
<target name="diagnostics">
<echoproperties />
</target>
</project>