Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
	*   '$RCSfile$'
4
	*     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
	*   Copyright: 2000 Regents of the University of California and the
6
	*              National Center for Ecological Analysis and Synthesis
7
	* For Details: http://www.nceas.ucsb.edu/
8
	*
9
	*    '$Author: tao $'
10
	*    '$Date: 2014-08-06 13:43:18 -0700 (Wed, 06 Aug 2014) $'
11
	*    '$Revision: 8828 $'
12
	*
13
	* Build file for the Ant cross-platform build system for metacat
14
	* See http://jakarta.apache.org for details on Ant
15
	*
16
	* usage: ant [compile|jar|install|documentation]
17
	*
18
	* This program is free software; you can redistribute it and/or modify
19
	* it under the terms of the GNU General Public License as published by
20
	* the Free Software Foundation; either version 2 of the License, or
21
	* (at your option) any later version.
22
	*
23
	* This program is distributed in the hope that it will be useful,
24
	* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
	* GNU General Public License for more details.
27
	*
28
	* You should have received a copy of the GNU General Public License
29
	* along with this program; if not, write to the Free Software
30
	* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir="."
33
         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
34
	<property environment="env" />
35
	<property file="build.properties" /><!-- USER SPECIFIC PROPS -->
36
	<property name="java.target.version" value="1.6" /> <!-- the target version for java compilation-->
37
	<property name="java.source.version" value="1.6" /> <!-- the source code version for java compilation-->
38

    
39
    <!-- Configure the maven2 ant tasks -->
40
    <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
41
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
42
             uri="antlib:org.apache.maven.artifact.ant"
43
             classpathref="maven-ant-tasks.classpath" />
44
	
45
	<!-- defining the axis tasks -->
46
	<path id="axis.ant.classpath">
47
		<fileset dir="lib/lsid_lib">
48
			<include name="*.jar" />
49
		</fileset>
50
	</path>
51
	
52
	<!-- Allow integration with Git projects -->
53
	<macrodef name = "git">
54
	    <attribute name = "command" />
55
	    <attribute name = "dir" default = "" />
56
	    <element name = "args" optional = "true" />
57
	    <sequential>
58
	        <echo message = "git @{command}" />
59
	        <exec executable = "git" dir = "@{dir}">
60
	            <arg value = "@{command}" />
61
	            <args/>
62
	        </exec>
63
	    </sequential>
64
	</macrodef>
65
	<macrodef name = "git-clone-pull">
66
	    <attribute name = "repository" />
67
	    <attribute name = "dest" />
68
	    <attribute name = "refname" />
69
	    <sequential>
70
	        <git command = "clone">
71
	            <args>
72
	                <arg value = "@{repository}" />
73
	                <arg value = "@{dest}" />
74
	            </args>
75
	        </git>
76
	        <git command = "checkout" dir = "@{dest}">
77
	        	<args>
78
	                <arg value = "@{refname}" />
79
	            </args>
80
	        </git>
81
	    	<git command = "pull" dir = "@{dest}" >
82
	        	<args>
83
	                <arg value = "@{repository}" />
84
	                <arg value = "@{refname}" />
85
	            </args>
86
	        </git>
87
	    </sequential>
88
	</macrodef>
89
	
90
	<!-- get metacatUI project -->
91
	<target name="getMetacatUI" depends="init">
92
		<git-clone-pull repository="${metacatui.git.repository.url}" dest="${metacatui.build.dir}" refname="${metacatui.git.repository.refname}" />
93
	</target>
94
	
95
	<target name="build-metacat-ui" description="Calls the Maven build for metacatUI war" depends="getMetacatUI" unless="build-metacat-ui-called">
96
		<artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
97
			<arg value="clean"/>
98
		</artifact:mvn>
99
		<artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
100
		   <arg value="package"/>
101
		</artifact:mvn>
102
		<property name="build-metacat-ui-called" value="true"/>
103
	</target>
104
	
105
	<target name="dist-metacat-ui" depends="build-metacat-ui">
106
		<copy tofile="${dist.dir}/metacatui.war" >
107
			<fileset dir="${metacatui.build.dir}/metacatui/target" includes="*.war"></fileset>
108
		</copy>	
109
	</target>
110
    	
111
	<taskdef resource="axis-tasks.properties"
112
		classpathref="axis.ant.classpath" />
113
	
114
	<!-- Determine if ecogrid should be installed-->
115
	<condition property="enable.ecogrid">
116
		<equals arg1="${install.ecogrid}" arg2="true" />
117
	</condition>
118

    
119
	<!-- Determine if perl should be built-->
120
	<condition property="build.perl">
121
		<equals arg1="${make.perl.code}" arg2="true" />
122
	</condition>
123

    
124
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
125
			property="tomcat.common.exists" />
126

    
127
	<target name="config" depends="setTomcatCommon, setTomcatNoCommon">
128
		<!-- usr for client testing, generally you don't need change-->
129
		<property name="mcuser"
130
			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
131
		<property name="mcpassword" value="kepler" />
132
		<property name="mcanotheruser"
133
			value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
134
		<property name="mcanotherpassword" value="yourpass" />
135
		<property name="piscouser"
136
			value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
137
		<property name="piscopassword" value="yourpass" />
138
		<property name="lteruser"
139
			value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
140
		<property name="lterpassword" value="yourpass" />
141

    
142
		<property name="debug" value="on" />
143
		<property name="morphosourcedir" value="../morpho" />
144
		<property name="installdir"
145
			value="${app.deploy.dir}/${metacat.context}" />
146

    
147
		<echo>*********** set jsdk to ${jsdk}</echo>
148
	</target>
149
	
150
	<target name="setTomcatCommon" if="tomcat.common.exists" >
151
		<property name="jsdk"
152
			value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
153
	</target>
154
	
155
	<target name="setTomcatNoCommon" unless="tomcat.common.exists" >
156
		<property name="jsdk"
157
			value="${build.tomcat.dir}/lib/servlet-api.jar" />
158
	</target>
159
	
160
	<target name="init" depends="config, build-metacat-common" unless="init.called">
161
		
162
	    <property name="libdir.mvn" value="lib/maven" />
163
		<mkdir dir="${libdir.mvn}"/>
164
		
165
		<path id="base.classpath">
166
			<pathelement location="${jsdk}" />
167
            <pathelement location="lib" />
168
			
169
			<fileset dir="lib">
170
				<include name="*.jar" />
171
			</fileset>
172
			
173
			<fileset dir="lib/lsid_lib">
174
				<include name="*.jar" />
175
			</fileset>
176

    
177
			<!-- Include everything from maven -->
178
			<fileset dir="${libdir.mvn}">
179
				<include name="*.jar" />
180
			</fileset>
181

    
182
		</path>
183
		
184
		<path id="test.classpath">
185
			<pathelement location="${jsdk}" />
186
			<pathelement location="lib" />
187
			<fileset dir="lib">
188
				<include name="*.jar" />
189
				<exclude name="maven-ant-tasks-2.1.0.jar" />
190
			</fileset>
191
			<fileset dir="lib/lsid_lib">
192
				<include name="*.jar" />
193
			</fileset>
194
			<!-- Include maven -->
195
			<fileset dir="${libdir.mvn}">
196
				<include name="*.jar" />
197
			</fileset>
198
		</path>
199
		
200
		<!-- define the maven tasks -->
201
		<taskdef uri="antlib:org.apache.maven.artifact.ant"
202
			       resource="org/apache/maven/artifact/ant/antlib.xml"
203
			       classpathref="base.classpath" />
204

    
205
	   	<!-- Resolve maven dependencies -->
206
		<artifact:pom id="metacatPom" file="pom.xml" />
207
		<artifact:dependencies filesetId="dependency.fileset" pomrefid="metacatPom" usescope="runtime"/>
208
		<artifact:dependencies pathId="dependency.classpath" pomrefid="metacatPom"/>
209
	   		   	
210
	   	<!-- combine base and dependencies for the classpath -->
211
	   	<path id="compile.classpath">
212
	   		<path refid="base.classpath" />	
213
	   		<path refid="dependency.classpath" />	
214
		</path>
215

    
216
		<!-- It is less likely you'll need to make any changes from here down,
217
			but customization is possible -->
218
		<property name="name" value="metacat" />
219
		<property name="Name" value="MetaCat" />
220
		<property name="debugprefix" value="${Name}:" />
221
		<property name="release" value="${metacat.version}" />
222
		<tstamp>
223
		    <format property="copyrightyear" pattern="yyyy" locale="en,US"/>
224
		</tstamp>
225
		<property name="copyright" value="${copyrightyear} Regents of the University of California" />
226
		<property name="style-common-relpath" value="/style/common" />
227
		<property name="style-shared-relpath" value="/style/shared" />
228
		<property name="schema-relpath" value="/schema" />
229
		<property name="style-common-cvsrelpath"
230
			value="lib${style-common-relpath}" />
231
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
232
		<property name="style-skins-relpath" value="/style/skins" />
233
		<property name="seek-tag" value="branches/ECOGRID_1_2_3" />
234
		<property name="eml-module" value="eml" />
235
		<property name="eml-version" value="2.0.0beta6" />
236
		<property name="eml-beta4-version" value="2.0.0beta4" />
237
		<property name="eml-beta-tag"
238
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
239
		<property name="eml-beta4-tag"
240
					value="RELEASE_EML_2_BETA_4" />
241
		<property name="eml2_0_0-schema-tag"
242
			value="RELEASE_EML_2_0_0_UPDATE_1" />
243
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
244
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
245
		<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
246
		<!--<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_7" />-->
247
		<property name="eml2-style-tag" value="trunk" />
248

    
249
		<property name="eml2_0_0namespace"
250
			value="eml://ecoinformatics.org/eml-2.0.0" />
251
		<property name="eml2_0_1namespace"
252
			value="eml://ecoinformatics.org/eml-2.0.1" />
253
		<property name="eml2_1_0namespace"
254
			value="eml://ecoinformatics.org/eml-2.1.0" />
255
		<property name="eml2_1_1namespace"
256
			value="eml://ecoinformatics.org/eml-2.1.1" />
257
		<property name="stmmlnamespace"
258
			value="http://www.xml-cml.org/schema/stmml" />
259
		<property name="stmml11namespace"
260
			value="http://www.xml-cml.org/schema/stmml-1.1" />
261
		<property name="eml-css" value="eml_xsl.css" />
262
		<property name="eml-module.default.css" value="default.css" />
263
		<property name="systemidserver" value="" />
264
		<property name="html-path" value="" />
265
		<property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
266

    
267

    
268
		<!-- Config for registry variables -->
269
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
270
		<property name="scope" value="obfs" />
271
		<property name="responseForm" value="genericResponse.tmpl" />
272
		<property name="entryForm" value="entryForm.tmpl" />
273
		<property name="guide" value="genericGuide.tmpl" />
274
		<property name="loginForm" value="loginForm.tmpl" />
275
		<property name="confirmData" value="confirmData.tmpl" />
276
		<property name="deleteData" value="deleteData.tmpl" />
277
		<property name="genericHeader" value="genericHeader.tmpl" />
278
		<property name="genericFooter" value="genericFooter.tmpl" />
279

    
280
		<filter token="scope" value="${scope}" />
281
		<filter token="responseForm" value="${responseForm}" />
282
		<filter token="entryForm" value="${entryForm}" />
283
		<filter token="guide" value="${guide}" />
284
		<filter token="loginForm" value="${loginForm}" />
285
		<filter token="confirmData" value="${confirmData}" />
286
		<filter token="deleteData" value="${deleteData}" />
287
		<filter token="genericHeader" value="${genericHeader}" />
288
		<filter token="genericFooter" value="${genericFooter}" />
289
		<filter token="adminname" value="${adminname}" />
290
		<filter token="recipient" value="${recipient}" />
291
		<filter token="metacatVersion" value="${metacat.version}" />
292
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
293
		<filter token="build.context" value="${metacat.context}" />
294

    
295
		<filter token="docrooturl" value="./" />
296
		<filter token="mcuser" value="${mcuser}" />
297
		<filter token="mcpassword" value="${mcpassword}" />
298
		<filter token="mcanotheruser" value="${mcanotheruser}" />
299
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
300
		<filter token="eml-css" value="${eml-css}" />
301
		<filter token="style-skins-relpath"
302
			value="${style-skins-relpath}" />
303
		<filter token="style-common-relpath"
304
			value="${style-common-relpath}" />
305

    
306
		<filter token="eml-version" value="${eml-version}" />
307
		<filter token="eml-beta4-version" value="${eml-beta4-version}" />
308
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
309
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
310
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
311
		<filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
312
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
313
		<filter token="stmml11namespace" value="${stmml11namespace}" />
314
		<filter token="debugprefix" value="${debugprefix}" />
315

    
316
		<filter token="defaultStage" value="${defaultStage}" />
317
		<filter token="defaultHeader" value="${defaultHeader}" />
318
		<filter token="defaultFooter" value="${defaultFooter}" />
319
		<filter token="defaultChangePass" value="${defaultChangePass}" />
320
		<filter token="defaultResetPass" value="${defaultResetPass}" />
321
		<filter token="changePassSuccess" value="${changePassSuccess}" />
322
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
323
		<filter token="registerFailed" value="${registerFailed}" />
324
		<filter token="registerLter" value="${registerLter}" />
325
		<filter token="registerMatch" value="${registerMatch}" />
326
		<filter token="registerSuccess" value="${registerSuccess}" />
327
		<filter token="register" value="${register}" />
328
		<filter token="searchResults" value="${searchResults}" />
329
		<filter token="ldapMainServerFailure"
330
			value="${ldapMainServerFailure}" />
331
		<filter token="lter-user" value="${lteruser}" />
332
		<filter token="lter-pass" value="${lterpassword}" />
333
		<filter token="pisco-user" value="${piscouser}" />
334
		<filter token="pisco-pass" value="${piscopassword}" />
335

    
336

    
337
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
338
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
339
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
340

    
341
		<property name="srcdir" value="./src" />
342
		<property name="lib.dir" value="./lib" />
343
		<property name="docdir" value="./docs" />
344
		<property name="cgidir" value="./cgi-bin" />
345
		<property name="testdir" value="./test" />
346
		<property name="testtorun" value="MNodeServiceTest" />
347
		<property name="junittestsdir"
348
			value="./test/edu/ucsb/nceas/metacattest" />
349
		<property name="junitnettestsdir"
350
			value="./test/edu/ucsb/nceas/metacatnettest" />
351
		<property name="classtorun" value="edu.ucsb.nceas.metacat.admin.upgrade.dataone.GenerateSystemMetadata" />
352
		<property name="build.dir" value="./build" />
353
		<property name="build.src" value="${build.dir}/src" />
354
		<property name="build.dest" value="${build.dir}/classes" />
355
		<property name="build.samples" value="${build.dir}/samples" />
356
		<property name="build.tests" value="${build.dir}/tests" />
357
		<property name="build.tmp" value="${build.dir}/tmp" />
358
		<property name="build.metacattest"
359
			value="${build.tests}/metacattest" />
360
		<property name="build.metacatnettest"
361
			value="${build.tests}/metacatnettest" />
362
		<property name="build.data" value="${build.dir}/data" />
363
		<property name="build.docs" value="${build.dir}/docs" />
364
		<property name="build.javadocs" value="${build.docs}/api" />
365
		<property name="build.war" value="${build.dir}/war" />
366
		<property name="dist.dir" value="dist" />
367
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
368
		<property name="ver.src" value="${ver.dir}/src" />
369
		<property name="test.dir" value="${dist.dir}/test" />
370
		<!-- directories for creating a Harvest List Editor distribution -->
371
		<property name="dist.dir.hle" value="disthle" />
372
		<property name="ver.dir.hle"
373
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
374
		<property name="pkg.dir" value="./package" />
375
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
376

    
377
		<property name="ecogrid-target-name" value="metacatImpl" />
378
		<property name="ecogrid-module-dest-dir" value=".." />
379
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
380
		<property name="ecogrid-dist-dir"
381
			value="${dist.dir}/${ecogrid-module}" />
382
		<property name="ecogrid-dir"
383
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
384

    
385
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
386

    
387
		<!-- set up svn -->
388
		<property name="svnant.lib" value="lib" />
389
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
390
		<property name="svnClientAdapter.jar"
391
			value="${svnant.lib}/svnClientAdapter.jar" />
392
		<property name="svnjavahl.jar"
393
			value="${svnant.lib}/svnjavahl.jar" />
394
		<property name="svn.ecogridUrl"
395
			value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
396
		<property name="svn.emlBetaUrl"
397
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
398
		<property name="svn.emlBeta4Url"
399
					value="https://code.ecoinformatics.org/code/eml/tags/${eml-beta4-tag}" />
400
		<property name="svn.eml200SchemaUrl"
401
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
402
		<property name="svn.eml201SchemaUrl"
403
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
404
		<property name="svn.eml210SchemaUrl"
405
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
406
		<property name="svn.eml211SchemaUrl"
407
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" />
408
		<property name="svn.eml2StyleUrl"
409
			value="https://code.ecoinformatics.org/code/eml/${eml2-style-tag}" />
410
		
411
		<!-- the git repo -->
412
		<property name="metacatui.git.repository.url"
413
					value="https://github.com/NCEAS/metacatui.git" />
414
		<property name="metacatui.git.repository.refname"
415
							value="METACATUI_1_5_1" />
416
		<!--<property name="metacatui.git.repository.refname"
417
									value="master" />-->
418
		<property name="metacatui.build.dir"
419
					value="metacatui_build" />
420
		<property name="metacatui.resources.dir"
421
					value="${metacatui.build.dir}/metacatui/src/main/webapp" />
422
		
423
		<!-- load the svn task -->
424
		<path id="svn.classpath">
425
			<pathelement location="${svnjavahl.jar}" />
426
			<pathelement location="${svnant.jar}" />
427
			<pathelement location="${svnClientAdapter.jar}" />
428
		</path>
429
		<taskdef resource="svntask.properties"
430
			classpathref="svn.classpath" />
431

    
432
		<condition property="eml.required">
433
			<or>
434
				<not>
435
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
436
				</not>
437
				<not>
438
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
439
				</not>
440
				<not>
441
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
442
				</not>
443
				<not>
444
					<available
445
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
446
				</not>
447
			</or>
448
		</condition>
449

    
450
		<condition property="ecogrid.required">
451
			<or>
452
				<not>
453
					<available file="${ecogrid-dir}/build.properties" />
454
				</not>
455
				<not>
456
					<available
457
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
458
				</not>
459
			</or>
460
		</condition>
461
		
462
		<property name="init.called" value="true" />
463

    
464
	</target>
465
	
466
	<target name="resolveDependencies" depends="init" description="retrieve dependencies with maven">
467
			<echo>Moving Maven dependencies (${dependency.fileset}) to ${libdir.mvn} </echo>
468
			<!-- Clear out mvn dir -->
469
			<delete dir="${libdir.mvn}"></delete>
470
			<!-- Copy all dependencies to the correct location. -->
471
			<copy todir="${libdir.mvn}">
472
				<fileset refid="dependency.fileset" />
473
				<!-- This mapper strips off all leading directory information -->
474
				<mapper type="flatten" />
475
			</copy>
476
		</target>
477

    
478
	<target name="prepare" depends="init, resolveDependencies">
479
		<mkdir dir="${build.dir}" />
480
		<mkdir dir="${build.src}" />
481
		<mkdir dir="${build.dest}" />
482
		<mkdir dir="${build.docs}" />
483
		<mkdir dir="${build.javadocs}" />
484
		<mkdir dir="${build.tmp}" />
485

    
486
		<copy todir="${build.src}" filtering="yes">
487
			<fileset dir="${srcdir}">
488
				<include name="edu/**" />
489
				<include name="com/**" />
490
				<include name="org/**" />
491
				<!-- include name="java/**" / -->
492
				<include name="**/*.sql" />
493
				<exclude name="**/CVS*" />
494
				<exclude name="**/.#*" />
495
				<exclude name="edu/ucsb/nceas/workflowscheduler/**" />
496
			</fileset>
497
		</copy>
498
		<available file="lib/style/common/emlb6toeml2" type="dir"
499
			property="styles.not.needed" />
500
	</target>
501

    
502
	<target name="generateStubs" depends="prepare">
503
		<echo
504
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
505
		<axis-wsdl2java verbose="true" output="${srcdir}"
506
			url="/tmp/KeplerWebService.wsdl" />
507
	</target>
508

    
509
	<target name="compile" depends="prepare"
510
		description="Compiles java code to build dir, and copies metacat props files there">
511

    
512
		<javac srcdir="${build.src}" destdir="${build.dest}"
513
			target="${java.target.version}"
514
			source="${java.source.version}"
515
			debug="${debug}"
516
			excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
517
			<classpath>
518
				<path refid="compile.classpath" />
519
			</classpath>
520
		</javac>
521
	</target>
522

    
523
	<target name="jar" depends="compile,geteml"
524
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
525

    
526
		<delete file="${build.dir}/${name}.jar" />
527
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
528
			excludes="**/protocols/ **/harvesterClient/" />
529
	</target>
530

    
531
	<target name="protocol" depends="compile"
532
		description="Compiles and jars protocol java code to protocol.jar in build dir">
533
		<delete file="${build.dir}/protocol.jar" />
534
		<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
535
			includes="**/protocols/" />
536
	</target>
537

    
538

    
539
	<target name="client" depends="prepare"
540
		description="Compiles metacat-client java code to build dir">
541
		<javac srcdir="${build.src}" destdir="${build.dest}"
542
			target="${java.target.version}"
543
			source="${java.source.version}"
544
			includes="edu/ucsb/nceas/metacat/client/*">
545
			<classpath>
546
				<path refid="compile.classpath" />
547
			</classpath>
548
		</javac>
549
	</target>
550

    
551
	<target name="clientjar" depends="client"
552
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
553
		<delete file="${build.dir}/${name}-client.jar" />
554
		<jar jarfile="${build.dir}/${name}-client.jar"
555
			basedir="${build.dest}" includes="**/metacat/client/" />
556
	</target>
557

    
558
	<target name="advancedsearchjar" depends="compile"
559
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
560
		<delete file="${build.dir}/advancedsearch.jar" />
561
		<jar jarfile="${build.dir}/advancedsearch.jar"
562
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
563
	</target>
564

    
565
	<target name="harvester" depends="client"
566
		description="Compiles harvester java code to build dir">
567
		<javac srcdir="${build.src}" destdir="${build.dest}"
568
			target="${java.target.version}"
569
			source="${java.source.version}"
570
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
571
			<classpath>
572
				<path refid="compile.classpath" />
573
			</classpath>
574
		</javac>
575
	</target>
576
		
577
	<target name="harvesterjar" depends="harvester"
578
		description="Compiles and jars harvester java code to harvester.jar in build dir">
579
		<delete file="${build.dir}/harvester.jar" />
580
		<jar jarfile="${build.dir}/harvester.jar"
581
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
582
	</target>
583

    
584
	<target name="harvestListEditorDist" depends="harvesterjar"
585
		description="Prepares a distribution of the Harvest List Editor tool">
586
		<mkdir dir="${dist.dir.hle}" />
587
		<delete dir="${ver.dir.hle}" />
588
		<mkdir dir="${ver.dir.hle}" />
589
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
590
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
591
		<copy todir="${ver.dir.hle}"
592
			file="lib/harvester/harvestList.xsd" />
593
		<copy todir="${ver.dir.hle}"
594
			file="lib/harvester/harvestListEditor.bat" />
595
		<copy todir="${ver.dir.hle}"
596
			file="lib/harvester/harvestListEditor.sh" />
597
		<delete file="./harvest-list-editor-${release}.zip" />
598
		<zip zipfile="./harvest-list-editor-${release}.zip"
599
			basedir="${ver.dir.hle}" />
600
		<delete file="./harvest-list-editor-${release}.tar.gz" />
601
		<tar tarfile="./harvest-list-editor-${release}.tar"
602
			basedir="${ver.dir.hle}" />
603
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
604
			src="./harvest-list-editor-${release}.tar" />
605
		<delete file="./harvest-list-editor-${release}.tar" />
606
	</target>
607

    
608
	<target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
609
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
610

    
611
	<target name="getemlpre2" depends="prepare" if="eml.required"
612
		description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
613
		<svn>
614
			<export srcUrl="${svn.emlBetaUrl}"
615
				destPath="${build.tmp}/eml_${eml-beta-tag}" />
616
		</svn>
617
		<mkdir dir="lib/dtd" />
618
		<copy todir="lib/dtd" filtering="yes">
619
			<fileset
620
				dir="${build.tmp}/eml_${eml-beta-tag}">
621
				<include name="*.dtd" />
622
			</fileset>
623
			<mapper type="glob" from="eml-*.dtd"
624
				to="eml-*-${eml-version}.dtd" />
625
		</copy>
626

    
627
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
628
			<fileset
629
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
630
				<include name="**/*.xsl" />
631
			</fileset>
632
		</copy>
633
	</target>
634
	
635
	<target name="getemlpre2beta4" depends="prepare" if="eml.required"
636
			description="Checks EML-beta4 out of svn and copies dtds to your metacat sandbox">
637
			<svn>
638
				<export srcUrl="${svn.emlBeta4Url}"
639
					destPath="${build.tmp}/eml_${eml-beta4-tag}" />
640
			</svn>
641
			<mkdir dir="lib/dtd" />
642
			<copy todir="lib/dtd" filtering="yes">
643
				<fileset
644
					dir="${build.tmp}/eml_${eml-beta4-tag}">
645
					<include name="*.dtd" />
646
				</fileset>
647
				<mapper type="glob" from="eml-*.dtd"
648
					to="eml-*-${eml-beta4-version}.dtd" />
649
			</copy>
650

    
651
			<!--
652
			<copy todir="${style-common-cvsrelpath}" filtering="yes">
653
				<fileset
654
					dir="${build.tmp}/eml_${eml-beta4-tag}/style">
655
					<include name="**/*.xsl" />
656
				</fileset>
657
			</copy>
658
			-->
659
		</target>
660

    
661
	<target name="geteml2+" depends="prepare" if="eml.required"
662
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
663
		<svn>
664
			<export srcUrl="${svn.eml200SchemaUrl}"
665
				destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
666
		</svn>
667
		<mkdir dir="lib/schema/eml-2.0.0" />
668
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
669
			<fileset
670
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
671
				<include name="*.xsd" />
672
			</fileset>
673

    
674
			<!-- shouldn't we have a mapper here like this??
675
				<mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
676
				
677
				Jing's code didn't nave one - does it need to be added?
678
				NOTE that eml-version is set to beta 6, so this would need changing -->
679

    
680
		</copy>
681
		<!-- <antcall target="copyxsl">
682
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
683
			<param name="dirname" value="eml-2.0.0" />
684
			</antcall> -->
685

    
686
		<!-- Checkout eml201 for given schema tag-->
687
		<svn>
688
			<export srcUrl="${svn.eml201SchemaUrl}"
689
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
690
		</svn>
691
		<mkdir dir="lib/schema/eml-2.0.1" />
692
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
693
			<fileset
694
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
695
				<include name="*.xsd" />
696
			</fileset>
697
		</copy>
698

    
699
		<!-- Checkout eml201 again for given style sheet tag-->
700
		<!-- echo>Enter CVS password: </echo>
701
			<cvs cvsRoot="${cvsroot}"
702
			package="${eml-module}"
703
			tag="${eml2_0_1-style-tag}"
704
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
705
			<antcall target="copyxsl">
706
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
707
			<param name="dirname" value="eml-2.0.1" />
708
			</antcall -->
709

    
710
		<!-- Checkout eml210 for given schema tag-->
711
		<svn>
712
			<export srcUrl="${svn.eml210SchemaUrl}"
713
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
714
		</svn>
715
		<mkdir dir="lib/schema/eml-2.1.0" />
716
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
717
			<fileset
718
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
719
				<include name="*.xsd" />
720
			</fileset>
721
		</copy>
722

    
723
		<!-- Checkout eml210 for given style sheet tag-->
724
		<svn>
725
			<export srcUrl="${svn.eml2StyleUrl}"
726
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
727
		</svn>
728
		<antcall target="copyxsl">
729
			<param name="cvs.tagname" value="${eml2-style-tag}" />
730
			<!-- param name="dirname" value="eml-2.1.0" / -->
731
			<param name="dirname" value="eml-2" />
732
		</antcall>
733
		
734
		<!-- Checkout eml210 for given schema tag-->
735
		<svn>
736
			<export srcUrl="${svn.eml211SchemaUrl}"
737
				destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
738
		</svn>
739
		<mkdir dir="lib/schema/eml-2.1.1" />
740
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
741
			<fileset
742
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
743
				<include name="*.xsd" />
744
			</fileset>
745
		</copy>
746
	</target>
747

    
748
	<target name="copyxsl"
749
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
750

    
751
		<delete file="${style-common-cvsrelpath}/${eml-css}" />
752

    
753
		<copy todir="${style-common-cvsrelpath}/${dirname}"
754
			filtering="yes">
755
			<fileset
756
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
757
				<include name="**/*.xsl" />
758
			</fileset>
759
		</copy>
760

    
761

    
762
		<!-- now copy default css from eml module and put it in style-common-path
763
			dir with a new name, so other skin-specific css can import it if reqd -->
764
		<copy
765
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
766
			tofile="${style-common-cvsrelpath}/${eml-css}" />
767

    
768
	</target>
769

    
770
	<target name="correctEML201Docs" depends="jar"
771
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
772
		<copy todir="${build.dir}" file="lib/metacat.properties"
773
			filtering="yes" />
774
		<java
775
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
776
			<classpath>
777
				<path refid="compile.classpath" />
778
				<fileset dir="${build.dir}">
779
					<include name="${name}.jar" />
780
				</fileset>
781
			</classpath>
782
		</java>
783
	</target>
784

    
785
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
786
		description="Installs spatial option for metacat">
787
		
788
		<copy todir="${dist.dir}">
789
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
790
		</copy>
791

    
792
	</target>
793

    
794
	<target name="install" depends="build-metacat"
795
		description="* Install Metacat For Development *">
796
		<copy file="${dist.dir}/${metacat.context}.war"
797
			todir="${app.deploy.dir}" />
798
		<delete dir="${app.deploy.dir}/${metacat.context}" />
799
		<copy file="${dist.dir}/geoserver.war"
800
					todir="${app.deploy.dir}" />
801
		<delete dir="${app.deploy.dir}/geoserver" />
802
		<copy file="${dist.dir}/metacat-index.war"
803
					todir="${app.deploy.dir}" />
804
		<delete dir="${app.deploy.dir}/metacat-index" />
805
		<copy file="${dist.dir}/metacatui.war"
806
					todir="${app.deploy.dir}" />
807
		<delete dir="${app.deploy.dir}/metacatui" />
808
		<tstamp>
809
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
810
		</tstamp>
811
		<echo>Dev install completed at ${NOW}</echo>
812
	</target>
813

    
814
	<target name="build-metacat" depends="install-ecogrid, install-spatial, dist-metacat-index, dist-metacat-ui"
815
		description="Build Metacat">
816
	</target>
817

    
818
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
819
		if="enable.ecogrid" description="Install Ecogrid Compentent">
820
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
821
			inheritall="false">
822
			<property name="context" value="${metacat.context}" />
823
			<property name="target" value="${ecogrid-target-name}" />
824
		</ant>
825
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
826
			inheritall="false">
827
			<property name="context" value="${metacat.context}" />
828
			<property name="target" value="${ecogrid-target-name}" />
829
			<property name="metacat.dir" value="${basedir}"/>
830
		</ant>
831
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
832
			<webinf dir="${ecogrid-dir}/lib">
833
			<include name="server-config.wsdd"/>
834
			</webinf>
835
			</war -->
836
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
837
			todir="${dist.dir}" overwrite="true" />
838

    
839

    
840
	</target>
841

    
842
	<target name="get-ecogrid" depends="init"
843
		description="Check out ecogrid module" if="ecogrid.required">
844
		<svn>
845
			<export srcUrl="${svn.ecogridUrl}" force="true"
846
				destPath="${ecogrid-dir}" />
847
		</svn>
848
	</target>
849

    
850
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
851
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
852
		<property name="context" value="${metacat.context}"/>
853
		<property name="target" value="${ecogrid-target-name}"/>
854
		<property name="metacat.dir" value="."/>
855
		<property name="hostname" value="${ecogrid.hostname}"/>
856
		<property name="port" value="${config.port}"/>
857
		</ant>
858
		</target -->
859

    
860
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
861
		description="Automately generate wsdd for ecogrid service">
862
		<delete
863
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
864
	</target>
865

    
866
	<target name="install-skin" depends="init"
867
		description="Install a Skin">
868

    
869
		<input message="Please enter name of the skin"
870
			addproperty="skin-name" />
871

    
872
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
873
		<copy todir="${installdir}/style/skins/${skin-name}"
874
			filtering="yes">
875
			<fileset dir="lib/style/skins/${skin-name}">
876
				<exclude name="**/*.png" />
877
				<exclude name="**/*.gif" />
878
				<exclude name="**/*.jpg" />
879
				<exclude name="**/CVS*" />
880
				<exclude name="**/.#*" />
881
			</fileset>
882
		</copy>
883
		<copy todir="${installdir}/style/skins/${skin-name}"
884
			filtering="no">
885
			<fileset dir="lib/style/skins/${skin-name}">
886
				<include name="**/*.png" />
887
				<include name="**/*.gif" />
888
				<include name="**/*.jpg" />
889
				<exclude name="**/CVS*" />
890
				<exclude name="**/.#*" />
891
			</fileset>
892
		</copy>
893
		<copy todir="${installdir}/style/common" filtering="yes">
894
			<fileset dir="lib/style/common">
895
				<include name="*.js" />
896
				<include name="*.jsp" />
897
				<include name="*.css" />
898
				<exclude name="*.png" />
899
				<exclude name="*.gif" />
900
				<exclude name="*.jpg" />
901
				<exclude name="**/CVS*" />
902
				<exclude name="**/.#*" />
903
			</fileset>
904
		</copy>
905
		<!--
906
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
907
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
908
			<fileset dir="lib/style/skins/${skin-name}/images">
909
			<include name="*.png"/>
910
			<include name="*.gif"/>
911
			<include name="*.jpg"/>
912
			</fileset>
913
			</copy>
914
		-->
915

    
916
		<echo message="Install Skin completed." />
917
	</target>
918

    
919
	<target name="war" depends="warPrepare,install-spatial"
920
		description="Create a web archive (WAR) for servlet deployment">
921
		<mkdir dir="${dist.dir}" />
922
		<war destfile="${dist.dir}/${metacat.context}.war"
923
			webxml="${build.war}/web.xml">
924
			<fileset dir="${war.context}" />
925
			<lib dir="${war.lib}" />
926
			<webinf dir="${war.webinf}" />
927
		</war>
928
	</target>
929

    
930
	<target name="warPrepare"
931
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation"
932
		description="Prepare files for creating a web archive (WAR)">
933

    
934
		<property name="war.lib" value="${build.war}/lib" />
935
		<property name="war.webinf" value="${build.war}/WEB-INF" />
936
		<property name="war.context"
937
			value="${build.war}/${metacat.context}" />
938
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
939
		<property name="war.webinf.scripts"
940
			value="${war.webinf}/scripts" />
941
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
942
		<property name="war.context.docs" value="${war.context}/docs" />
943
		<property name="war.context.temp" value="${war.context}/temp" />
944
		<property name="war.context.templates"
945
			value="${war.context}${style-common-relpath}/templates" />
946
		<mkdir dir="${war.lib}" />
947
		<mkdir dir="${war.webinf}" />
948
		<mkdir dir="${war.context}" />
949
		<mkdir dir="${war.webinf.sql}" />
950
		<mkdir dir="${war.context.cgi}" />
951
		<mkdir dir="${war.context.docs}" />
952
		<mkdir dir="${war.context.temp}" />
953
		<mkdir dir="${war.context.templates}" />
954

    
955
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
956
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
957
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
958
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
959
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
960
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
961
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
962
		<copy todir="${war.lib}" filtering="no">
963
			<fileset dir="lib">
964
				<include name="*.jar" />
965
				<exclude name="maven-ant-tasks*.jar" />
966
			</fileset>
967
			<fileset dir="${libdir.mvn}" />			
968
		</copy>
969
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
970
			tofile="${build.war}/web.xml" / -->
971
		<!-- MCD added next - Remove the tomcat5 reference-->
972
		<copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
973
		<copy file="lib/metacat.properties" todir="${war.webinf}"
974
			filtering="yes" />
975
		<copy todir="${war.webinf}" filtering="yes">
976
		    <fileset dir="lib/account-web-info">
977
		       <exclude name="web.xml" />
978
		    </fileset>
979
		</copy>
980
		<copy file="lib/solrQueryFieldDescriptions.properties" todir="${war.webinf}"/>
981
		<copy file="lib/metacat.properties.metadata.xml"
982
			todir="${war.webinf}" filtering="no" />
983
		<copy file="lib/org.properties.metadata.xml"
984
			todir="${war.webinf}" filtering="no" />
985
		<copy file="lib/auth.properties.metadata.xml"
986
			todir="${war.webinf}" filtering="no" />
987
		<copy todir="${war.webinf}" filtering="yes">
988
			<fileset dir="lib">
989
				<include name="skin.configs/**" />
990
			</fileset>
991
		</copy>
992
		<copy file="lib/log4j.properties" todir="${war.webinf}"
993
			filtering="yes" />
994
		<copy file="lib/hazelcast.xml" todir="${war.webinf}"
995
			filtering="yes" />
996
		<copy file="lib/oa4mp_client.xml" todir="${war.webinf}"
997
			filtering="yes" />
998
		<copy todir="${war.context}" filtering="no">
999
			<fileset dir="lib">
1000
				<include name="**/*.jpg" />
1001
				<include name="**/*.png" />
1002
				<include name="**/*.gif" />
1003
				<include name="LiveMap_30/**" />
1004
				<include name="oaipmh/**" />
1005
			</fileset>
1006
		</copy>
1007
		<copy todir="${war.context}" filtering="yes">
1008
			<fileset dir="lib">
1009
				<exclude name="*.jar" />
1010
				<exclude name="*.properties" />
1011
				<exclude name="*.metadata.xml" />
1012
				<exclude name="web.xml" />
1013
				<exclude name="**/*.jpg" />
1014
				<exclude name="**/*.png" />
1015
				<exclude name="**/*.gif" />
1016
				<exclude name="lsid_lib/**" />
1017
				<exclude name="lsid_conf/**" />
1018
				<exclude name="LiveMap_30/**" />
1019
				<exclude name="oaipmh/**" />
1020
				<exclude name="maven/**" />
1021
				<exclude name="skin.configs/**" />
1022
				<exclude name="spatial/geoserver/**" />
1023
			</fileset>
1024
		</copy>
1025
		<copy todir="${war.context}" filtering="no">
1026
			<fileset dir="lib">
1027
				<include name="spatial/geoserver/data/**" />
1028
			</fileset>
1029
		</copy>
1030
		<copy todir="${war.context.docs}" filtering="no">
1031
			<fileset dir="${build.docs}" />
1032
		</copy>
1033
		<copy todir="${war.webinf.sql}" filtering="yes">
1034
			<fileset dir="src">
1035
				<include name="**/*.sql" />
1036
			</fileset>
1037
		</copy>
1038
		<copy todir="${war.webinf.scripts}" filtering="yes">
1039
			<fileset dir="src/scripts" />
1040
		</copy>
1041
		<copy todir="${war.webinf.scripts}"
1042
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1043
			failonerror="false" />
1044

    
1045
		<copy file="src/perl/register-dataset.cgi"
1046
			todir="${war.context.cgi}" />
1047
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1048
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1049

    
1050
		<!-- registry cgi section -->
1051
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
1052
			used in readDocumentFromMetacat -->
1053
		<!-- TODO MCD copy temp files to actual location using config util?? -->
1054
		<copy todir="${war.context.temp}" filtering="yes">
1055
			<fileset dir="lib/style/common/emlb6toeml2">
1056
				<include name="*.xsl" />
1057
				<include name="*.xml" />
1058
			</fileset>
1059
		</copy>
1060
		<available file="lib/style/common/emlb6toeml2" type="dir"
1061
			property="styles.not.needed" />
1062

    
1063
		<!-- ldap cgi section -->
1064
		<copy todir="${war.context.templates}">
1065
			<fileset dir="lib/style/common/templates">
1066
				<!-- SCW: Copy all files -->
1067
			</fileset>
1068
		</copy>
1069
	</target>
1070

    
1071
	<target name="cgiPrepare" if="build.perl">
1072
		<exec dir="src/perl/Metacat/" executable="make">
1073
			<arg value="clean" />
1074
		</exec>
1075
		<exec dir="src/perl/Metacat/" executable="perl">
1076
			<arg value="Makefile.PL" />
1077
		</exec>
1078
		<exec dir="src/perl/Metacat/" executable="make" />
1079
	</target>
1080

    
1081
	<target name="testPrepare"
1082
		description="Copies test files into the war directories">
1083
		<echo>in testPrepare</echo>
1084
		<property name="war.context.test"
1085
			value="${build.war}/${metacat.context}/test" />
1086
		<mkdir dir="${war.context.test}" />
1087
		<copy todir="${war.context.test}" filtering="yes">
1088
			<fileset dir="test/servertestfiles">
1089
				<include name="*/**" />
1090
			</fileset>
1091
		</copy>
1092
	</target>
1093

    
1094
	<target name="getConversionXSL" depends="prepare"
1095
		unless="styles.not.needed"
1096
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1097

    
1098
		<svn>
1099
			<export srcUrl="${svn.eml2StyleUrl}"
1100
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1101
		</svn>
1102

    
1103
		<mkdir dir="lib/style/common/emlb6toeml2" />
1104
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1105
			<fileset
1106
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1107
				<include name="*.xsl" />
1108
				<include name="*.xml" />
1109
			</fileset>
1110
		</copy>
1111
	</target>
1112

    
1113
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1114
		<mkdir dir="${build.tests}" />
1115
		<copy todir="${build.tests}" encoding="UTF-8">
1116
			<fileset dir="${testdir}">
1117
				<include name="edu/**" />
1118
			</fileset>
1119
		</copy>
1120
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1121

    
1122
		<path id="test.classpath">
1123
			<path refid="compile.classpath" />
1124
			<fileset dir="${build.dir}">
1125
				<include name="${name}.jar" />
1126
				<include name="${name}-client.jar" />
1127
				<include name="harvester.jar" />
1128
			</fileset>
1129
		</path>
1130
		
1131
		<pathconvert pathsep="${line.separator}|  |--" 
1132
		             property="echo.test.classpath"
1133
		             refid="test.classpath">
1134
		</pathconvert>
1135
		<echo message="|--test classpath" />
1136
		<echo message="|  |" />
1137
		<echo message="|  |-- ${echo.test.classpath}" />
1138
		
1139
		<!-- copy and compile the tests into a jar file -->
1140
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1141
			debug="on" includes="**/*.java" encoding="UTF-8">
1142
			<classpath refid="test.classpath" />
1143
		</javac>
1144

    
1145
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1146
			basedir="${build.tests}" >
1147
			<include name="**/*.class"/>
1148
			<include name="**/*.xml"/>
1149
		</jar>	
1150
		
1151
	</target>
1152

    
1153
	<target name="runoneclass" depends="testprep"
1154
		description="Uses the ant to run a class">
1155
		
1156
		<java classname="${classtorun}" fork="true">
1157
			<arg line="${args}" />
1158
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1159
			<classpath>
1160
				<path refid="test.classpath" />
1161
				<fileset dir="${build.dir}">
1162
					<include name="${name}.jar" />
1163
					<include name="${name}-client.jar" />
1164
					<include name="harvester.jar" />
1165
					<include name="${name}-junittests.jar" />
1166
				</fileset>
1167
			</classpath>
1168
		</java>
1169
	</target>
1170
	
1171
	<target name="test" depends="testprep"
1172
		description="Uses the ant junit task to run all JUnit tests">
1173

    
1174
		<!-- use the ant "junit" task to run JUnit tests. -->
1175
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1176
			haltonerror="no">
1177
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1178
			<classpath>
1179
				<path refid="test.classpath" />
1180
				<fileset dir="${build.dir}">
1181
					<include name="${name}.jar" />
1182
					<include name="${name}-client.jar" />
1183
					<include name="harvester.jar" />
1184
					<include name="${name}-junittests.jar" />
1185
				</fileset>
1186
			</classpath>
1187

    
1188
			<formatter type="plain" />
1189

    
1190
			<batchtest fork="yes" todir="${build.dir}">
1191
				<fileset dir="${build.tests}">
1192
					<include name="**/*.class" />
1193
					<exclude name="**/MCTestCase.class" />
1194
					<exclude name="**/ClientViewHelperTest.class" />
1195
					<!-- these are not test cases -->
1196
					<exclude name="**/MockCNode.class" />
1197
					<exclude name="**/D1NodeServiceTest.class" />
1198
					<exclude name="**/QueryRunner.class" />
1199
					<exclude name="**/MockObjectPathMap.class" />
1200
					<exclude name="**/HzObjectPathMapTest$1.class" />
1201
					<exclude name="**/HzObjectPathMapTest$2.class" />
1202
				</fileset>
1203
			</batchtest>
1204
		</junit>
1205
	</target>
1206

    
1207
	<target name="runonetest" depends="testprep"
1208
		description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1209

    
1210
		<echo>testtorun: ${testtorun}</echo>
1211

    
1212
		<!-- use the ant "junit" task to run JUnit tests. -->
1213
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1214
			haltonerror="no" showoutput="yes">
1215
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1216
			<classpath>
1217
				<path refid="test.classpath" />
1218
				<fileset dir="${build.dir}">
1219
					<include name="${name}.jar" />
1220
					<include name="${name}-client.jar" />
1221
					<include name="harvester.jar" />
1222
					<include name="${name}-junittests.jar" />
1223
				</fileset>
1224
			</classpath>
1225

    
1226
			<formatter type="plain" />
1227

    
1228
			<batchtest fork="yes" todir="${build.dir}">
1229
				<fileset dir="${build.tests}">
1230
					<include name="**/${testtorun}.class" />
1231
				</fileset>
1232
			</batchtest>
1233
		</junit>
1234
	</target>
1235
	
1236
	<target name="run" depends="testprep"
1237
			description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1238

    
1239
			<echo>testtorun: ${testtorun}</echo>
1240

    
1241
			<!-- use the ant "junit" task to run JUnit tests. -->
1242
			<junit printsummary="yes" haltonfailure="no" fork="yes"
1243
				haltonerror="no" showoutput="yes">
1244
				<jvmarg value="-Dfile.encoding=UTF-8"/>
1245
				<classpath>
1246
					<path refid="test.classpath" />
1247
					<fileset dir="${build.dir}">
1248
						<include name="${name}.jar" />
1249
						<include name="${name}-client.jar" />
1250
						<include name="harvester.jar" />
1251
						<include name="${name}-junittests.jar" />
1252
					</fileset>
1253
				</classpath>
1254

    
1255
				<formatter type="plain" />
1256

    
1257
				<batchtest fork="yes" todir="${build.dir}">
1258
					<fileset dir="${build.tests}">
1259
						<include name="**/${testtorun}.class" />
1260
					</fileset>
1261
				</batchtest>
1262
			</junit>
1263
		</target>
1264

    
1265
	<target name="testharvester" depends="testprep"
1266
		description="Uses the ant junit task to test only the Harvester code">
1267
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1268
			haltonerror="off">
1269
			<classpath>
1270
				<path refid="compile.classpath" />
1271
				<fileset dir="${build.dir}">
1272
					<include name="${name}.jar" />
1273
					<include name="${name}-client.jar" />
1274
					<include name="harvester.jar" />
1275
					<include name="${name}-junittests.jar" />
1276
				</fileset>
1277
			</classpath>
1278
			<formatter type="plain" />
1279
			<batchtest fork="yes" todir="${build.dir}">
1280
				<fileset dir="${build.tests}">
1281
					<include name="**/harvesterClient/*.class" />
1282
				</fileset>
1283
			</batchtest>
1284
		</junit>
1285
	</target>
1286

    
1287
	<!-- run this target, we need to check out a another morpho souce dir was checked out. -->
1288
	<target name="nettest" depends="install"
1289
		description="compiles and runs the metacatnettest code">
1290

    
1291
		<echo>
1292
			*********************************** Please run ant
1293
			gethttpclient first! ***********************************
1294
		</echo>
1295
		<!-- copy and compile the tests into a jar file -->
1296
		<mkdir dir="${build.metacatnettest}" />
1297
		<javac srcdir="${junitnettestsdir}"
1298
			destdir="${build.metacatnettest}" includes="**/*.java">
1299
			<classpath>
1300
				<path refid="compile.classpath" />
1301
				<fileset dir="${build.dir}">
1302
					<include name="${name}.jar" />
1303
				</fileset>
1304
			</classpath>
1305
		</javac>
1306

    
1307
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1308
			basedir="${build.metacatnettest}" includes="**/*.class" />
1309

    
1310
		<!-- use the ant "junit" task to run JUnit tests. -->
1311
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1312
			haltonerror="no">
1313
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1314
			<classpath>
1315
				<path refid="compile.classpath" />
1316
				<fileset dir="${build.dir}">
1317
					<include name="${name}.jar" />
1318
					<include name="${name}-junitnettests.jar" />
1319
				</fileset>
1320
			</classpath>
1321

    
1322
			<formatter type="plain" />
1323

    
1324
			<batchtest fork="yes" todir="${build.dir}">
1325
				<fileset dir="${build.metacatnettest}">
1326
					<include name="**/*.class" />
1327
				</fileset>
1328
			</batchtest>
1329
		</junit>
1330
	</target>
1331

    
1332
	<target name="cleanweb" depends="clean"
1333
		description="deletes tomcat web context dir and all its contents">
1334
		<delete dir="${installdir}" />
1335
	</target>
1336

    
1337

    
1338
	<target name="clean" depends="init"
1339
		description="deletes build dir and files that can be regenerated form the release">
1340
		<delete dir="${build.dir}" />
1341
		<delete dir="${dist.dir}" />
1342
	</target>
1343

    
1344
	<target name="fullclean" depends="clean"
1345
		description="deletes code and eml">
1346
		<delete includeEmptyDirs="true" failonerror="false">
1347
			<fileset dir="${style-common-cvsrelpath}">
1348
				<include name="${eml-css}" />
1349
				<include name="eml-*/*.xsl" />
1350
				<include name="eml-*" />
1351
			</fileset>
1352
			<fileset dir="${schema-cvsrelpath}">
1353
				<include name="eml-*/*.xsd" />
1354
			</fileset>
1355
			<fileset dir="${ecogrid-dir}"/>
1356
			<fileset dir="lib/style/common/emlb6toeml2"/>
1357
			<fileset dir="lib/dtd"/>
1358
			<fileset dir="${libdir.mvn}"/>
1359
		</delete>
1360
		<!-- remove the entire directory -->
1361
		<delete includeemptydirs="true" dir="${metacatui.build.dir}" />
1362
		<!-- clean up the distribution files if they exist-->
1363
		<delete file="./${name}-bin-${release}.tar.gz" />
1364
		<delete file="./${name}-src-${release}.tar.gz" />
1365
		<delete file="./${name}-bin-${release}.zip" />
1366
		<delete file="./${name}-src-${release}.zip" />
1367
	</target>
1368
	
1369
	<target name="documentation" depends="javadoc,admindoc"
1370
	    description="generates Javadoc API documentation and Admin Guide">
1371
    </target>
1372
	
1373
	<target name="admindoc" depends="prepare">
1374
		<!-- Build the administrator's guide, which is a Sphinx RST project
1375
		     For this to succeed, you must have Sphinx installed on your machine
1376
		     See: http://sphinx.pocoo.org/ for details
1377
		     And you must also have the 'make' build tool installed
1378
		-->
1379
		<exec dir="${docdir}/user/metacat" executable="make"> 
1380
		        <arg value="plantuml"/> 
1381
		</exec>
1382
		
1383
		<exec dir="${docdir}/user/metacat" executable="make"> 
1384
		        <arg value="html"/> 
1385
		</exec>
1386
		
1387
    </target>
1388

    
1389
	<target name="javadoc" depends="prepare"
1390
		description="generates Javadoc API documentation">
1391
		<javadoc packagenames="edu.ucsb.nceas.*"
1392
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1393
			version="true" use="true" windowtitle="${Name} API"
1394
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1395
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1396
			<classpath>
1397
				<path refid="compile.classpath" />
1398
			</classpath>
1399
		</javadoc>
1400
	</target>
1401

    
1402
	<target name="dist"
1403
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL"
1404
		description="prepares a full release distribution">
1405
		<mkdir dir="${dist.dir}" />
1406
		<delete dir="${ver.dir}" />
1407
		<mkdir dir="${ver.dir}" />
1408
		<copy todir="${ver.dir}">
1409
			<fileset dir="."
1410
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1411
		</copy>
1412
		<copy todir="${ver.dir}" file="build.xml" />
1413
		<copy todir="${ver.dir}" file="build.properties" />
1414

    
1415
		<copy todir="${ver.dir}/docs" filtering="yes">
1416
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1417
		</copy>
1418
		<copy todir="${ver.dir}/docs" filtering="no">
1419
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1420
		</copy>
1421
		<copy todir="${ver.dir}/docs/dev">
1422
			<fileset dir="${build.dir}/docs" />
1423
		</copy>
1424
		<copy todir="${ver.dir}/src">
1425
			<fileset dir="${build.dir}/src" />
1426
		</copy>
1427

    
1428
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1429
		<copy todir="${ver.dir}/test/servertestfiles">
1430
			<fileset dir="./test/servertestfiles" />
1431
		</copy>
1432
	</target>
1433

    
1434
	<target name="fulldist" depends="distbin, distsrc"
1435
			description="full distribution - source and bin"/>
1436
		
1437
	<target name="distbin" depends="build-metacat,war-lsid"
1438
		description="prepares a binary distribution">
1439
		<copy todir="${dist.dir}">
1440
			<fileset dir="./src/scripts" />
1441
		</copy>
1442
		<delete file="./${name}-bin-${release}.zip" />
1443
		<zip zipfile="./${name}-bin-${release}.zip"
1444
			basedir="${dist.dir}" />
1445
		<delete file="./${name}-bin-${release}.tar.gz" />
1446
		<tar tarfile="./${name}-bin-${release}.tar"
1447
			basedir="${dist.dir}" />
1448
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1449
			src="./${name}-bin-${release}.tar" />
1450
		<delete file="./${name}-bin-${release}.tar" />
1451
	</target>
1452

    
1453
	<target name="distsrc" depends="dist"
1454
		description="prepares a source distribution">
1455
		<mkdir dir="${ver.src}" />
1456
		<copy todir="${ver.src}">
1457
			<fileset dir="./src" />
1458
		</copy>
1459
		
1460

    
1461
		<mkdir dir="${ecogrid-dist-dir}" />
1462
		<copy todir="${ecogrid-dist-dir}">
1463
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1464
		</copy>
1465

    
1466

    
1467
		<delete file="./${name}-src-${release}.zip" />
1468
		<zip zipfile="./${name}-src-${release}.zip"
1469
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1470
		<delete file="./${name}-src-${release}.tar.gz" />
1471
		<tar tarfile="./${name}-src-${release}.tar"
1472
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1473
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1474
			src="./${name}-src-${release}.tar" />
1475
		<delete file="./${name}-src-${release}.tar" />
1476
		<!--delete dir="${dist.dir}"/ -->
1477
	</target>
1478

    
1479
	<target name="deb-package" depends="distbin"
1480
		description="create a debian installation package">
1481
		<delete dir="${deb.pkg.dir}" />
1482
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1483
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1484
			<fileset dir="./src/scripts/debian"
1485
				includes="control postinst" />
1486
		</copy>
1487

    
1488
		<mkdir
1489
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1490
		<copy
1491
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1492
			filtering="yes">
1493
			<fileset dir="./src/scripts/debian"
1494
				excludes="control postinst" />
1495
		</copy>
1496
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1497

    
1498
		<copy file="${dist.dir}/${metacat.context}.war"
1499
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1500
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1501
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1502

    
1503
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1504
			failonerror="true">
1505
			<arg line="--build debian" />
1506
		</exec>
1507

    
1508
		<move file="${pkg.dir}/debian.deb"
1509
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1510
	</target>
1511

    
1512
	<target name="stylesheettest">
1513
		<xslt in="${input}" out="eml.html"
1514
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1515
			<param name="displaymodule" expression="${displaymodule}" />
1516
			<param name="docid" expression="${input}" />
1517
			<param name="entitytype" expression="${entitytype}" />
1518
			<param name="entityindex" expression="${entityindex}" />
1519
			<outputproperty name="method" value="html" />
1520
			<outputproperty name="standalone" value="yes" />
1521
			<outputproperty name="encoding" value="iso8859_1" />
1522
			<outputproperty name="indent" value="yes" />
1523
		</xslt>
1524
	</target>
1525

    
1526
	<target name="spatial_option" depends="prepare"
1527
		description=" -- compiles code for the spatial option">
1528

    
1529
		<echo message="Compiling the metatcat shapefile creator" />
1530
		<echo message="using the shapelib at: ${shapelib.dir}" />
1531
		<exec dir="." executable="g++" os="Linux, Unix"
1532
			failonerror="true">
1533
			<arg
1534
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1535
		</exec>
1536

    
1537
		<exec dir="." executable="g++" os="Linux, Unix"
1538
			failonerror="true">
1539
			<arg
1540
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1541
		</exec>
1542
	</target>
1543

    
1544
	<!-- LSID Authority support -->
1545
	<patternset id="lsid.jars">
1546
		<include name="axis.jar" />
1547
		<include name="commons-discovery-0.2.jar" />
1548
		<include name="jaxrpc.jar" />
1549
		<include name="lsid-client-1.1.1.jar" />
1550
		<include name="lsid-server-1.1.1.jar" />
1551
		<include name="saaj.jar" />
1552
		<include name="wsdl4j-1.5.1.jar" />
1553
		<include name="activation.jar" />
1554
		<include name="castor-0.9.5.jar" />
1555
		<include name="dnsjava-1.3.2.jar" />
1556
		<include name="mail.jar" />
1557
		<include name="commons-logging-1.0.4.jar" />
1558
		<!-- These jars may be needed but seem to not actually be,
1559
			so leaving them out for now
1560
			<include name="axis-ant.jar" />
1561
		-->
1562
		<!--<include name="GenCastor.class" />-->
1563
	</patternset>
1564
	<patternset id="lib.jars">
1565
		<include name="log4j-1.2.12.jar" />
1566
		<include name="utilities-*.jar" />
1567
		<include name="xerces*.jar" />
1568
		<include name="xalan*.jar" />
1569
		<include name="xml-apis*.jar" />
1570
	</patternset>
1571

    
1572
	<path id="lsid.classpath">
1573
		<fileset dir="${lsid.lib.dir}">
1574
			<patternset refid="lsid.jars" />
1575
		</fileset>
1576
		<fileset dir="${lib.dir}">
1577
			<patternset refid="lib.jars" />
1578
		</fileset>
1579
		<fileset dir="${build.dir}">
1580
			<include name="metacat-client.jar" />
1581
			<include name="metacat.jar" />
1582
		</fileset>
1583
	</path>
1584

    
1585
	<filterset id="configFilters">
1586
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1587
			value="${config.hostname}" / -->
1588
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1589
			value="${config.port}" / -->
1590
		<!-- MCD BYE filter token="METADATA_LABELS"
1591
			value="${config.metadataLabelLsid}" / -->
1592
		<!-- MCD BYE filter token="METACAT_SERVER"
1593
			value="${config.metacatserver}" / -->
1594
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1595
			value="${config.lsidauthority}" / -->
1596
	</filterset>
1597

    
1598
	<target name="prepare-lsid" depends="prepare,clientjar"
1599
		description="Configure files prior to compilation">
1600
		<mkdir dir="${lsid.build.dir}" />
1601
		<!-- Copy the properties file into the build -->
1602
		<copy file="${conf.dir}/metacat-lsid.properties"
1603
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1604
			overwrite="true">
1605
			<filterset refid="configFilters" />
1606
		</copy>
1607
		<copy file="${conf.dir}/log4j.properties"
1608
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1609
			overwrite="true">
1610
			<filterset refid="configFilters" />
1611
		</copy>
1612
		<!-- Copy config files into the build -->
1613
		<copy todir="${lsid.build.dir}/WEB-INF">
1614
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1615
		</copy>
1616
		<!-- Copy the metadata configuration files into the build -->
1617
		<mkdir
1618
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1619
		<copy
1620
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1621
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1622
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1623
			<filterset refid="configFilters" />
1624
		</copy>
1625
		<!-- Copy services files into the build -->
1626
		<mkdir dir="${lsid.build.dir}/services" />
1627
		<copy todir="${lsid.build.dir}/services">
1628
			<fileset dir="${services.dir}" />
1629
			<filterset refid="configFilters" />
1630
		</copy>
1631
		<!-- Copy axis files into the build -->
1632
		<mkdir dir="${lsid.build.dir}" />
1633
		<copy todir="${lsid.build.dir}">
1634
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1635
		</copy>
1636
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1637
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1638
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1639
		</copy>
1640
	</target>
1641

    
1642
	<target name="compile-lsid" depends="prepare-lsid"
1643
		description="Compile Java sources">
1644
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1645
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1646
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1647
			deprecation="${compile.deprecation}"
1648
			target="${java.target.version}"
1649
			source="${java.source.version}"
1650
			optimize="${compile.optimize}">
1651
			<classpath>
1652
				<path refid="compile.classpath" />
1653
				<fileset dir="${build.dir}">
1654
					<include name="${name}.jar" />
1655
				</fileset>
1656
			</classpath>
1657
		</javac>
1658
	</target>
1659

    
1660
	<target name="war-lsid" depends="compile-lsid"
1661
		description="Create a war file for the application">
1662
		<mkdir dir="${dist.dir}" />
1663
		<war destfile="${dist.dir}/${authority.context}.war"
1664
			webxml="${webinf.dir}/web.xml">
1665
			<fileset dir="${lsid.build.dir}" />
1666
			<lib dir="${lsid.lib.dir}">
1667
				<patternset refid="lsid.jars" />
1668
			</lib>
1669
			<lib dir="${lib.dir}">
1670
				<patternset refid="lib.jars" />
1671
			</lib>
1672
			<lib dir="${lib.dir}">
1673
				<include name="xalan.jar" />
1674
				<include name="xml-apis.jar" />
1675
			</lib>
1676
			<lib dir="${build.dir}">
1677
				<include name="metacat-client.jar" />
1678
			</lib>
1679
		</war>
1680
	</target>
1681

    
1682
	<target name="deploy-lsid" depends="war-lsid"
1683
		description="Deploy LSID war to servlet container">
1684
		<delete dir="${app.deploy.dir}/${authority.context}" />
1685
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1686
		<mkdir dir="${app.deploy.dir}" />
1687
		<copy todir="${app.deploy.dir}">
1688
			<fileset dir="${dist.dir}" />
1689
		</copy>
1690
	</target>
1691
	
1692
	<target name="change-metacat-properties" depends="warPrepare"
1693
        description="Chage some default values of metacat.properties">
1694
       <echo file="${metacat-properties-file}" append="true">
1695
		   configutil.propertiesConfigured=true
1696
		   configutil.authConfigured=true
1697
           configutil.skinsConfigured=true
1698
		   configutil.databaseConfigured=true
1699
		   configutil.geoserverConfigured=true
1700
	   </echo>
1701
  </target>
1702
	
1703
	<!-- This target will use default values in svn metacat.properties to build a configured 
1704
		metacat (except configuti.* properties, they will be set true). Those default settings
1705
		are for a test machine. It may not work on your system-->
1706
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1707
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1708
    </target>
1709
	
1710
	<!-- build metacat-common jar -->
1711
	<target name="build-metacat-common" description="Calls the Maven build for metacat-common jar" unless="build-metacat-common-called" >
1712
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1713
		            <arg value="clean"/>
1714
		</artifact:mvn>
1715
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1716
		   <arg value="install"/>
1717
		</artifact:mvn>
1718
		<property name="build-metacat-common-called" value="true"/>
1719
	</target>
1720

    
1721
	<!-- build metacat-index war -->
1722
	<target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >		
1723
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1724
			<arg value="clean"/>
1725
		</artifact:mvn>
1726
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1727
			<arg value="package"/>
1728
			<!--<arg value="-Dmaven.test.skip=true"/>-->
1729
		</artifact:mvn>
1730
	</target>
1731
	
1732
	<target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >		
1733
		<copy tofile="${dist.dir}/metacat-index.war" >
1734
			<fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1735
		</copy>	
1736
	</target>
1737
	
1738
	<target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >		
1739
		<copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1740
	</target>
1741
	
1742
	<!-- Generate a light war file which only is used to manage the ldap user accounts - register a new user, reset and change the password -->
1743
	<target name="war-identity" depends="warPrepare" description="Generate a light war file which only is used to manage the ldap user accounts - register a new user, reset and change the password">
1744
		  <property name="war-name" value="identity" />
1745
		  <mkdir dir="${dist.dir}" />
1746
		     <war destfile="${dist.dir}/${war-name}.war"
1747
		            webxml="lib/account-web-info/web.xml">
1748
		      <webinf dir="${war.webinf}">
1749
		        <include name="metacat.properties"/>
1750
		        <include name="gd_intermediate_bundle_nceas_ldap.crt"/>
1751
		      </webinf>
1752
		      <fileset dir="${war.context}">
1753
		        <include name="cgi-bin/**"/>
1754
		      	<include name="style/**"/>  
1755
		      </fileset>
1756
		      
1757
		   </war>
1758
	</target>
1759
	
1760
</project>
(5-5/7)