3 <target name="echoUserPropertiesFileFound" if="user.properties.found">
4 <echo>Using properties file ${user.property.file}</echo>
7 <target name="echoUserPropertiesFileNotFound" unless="user.properties.found">
8 <echo>Properties file ${user.property.file} not found, reverting to defaults</echo>
12 <property name="project.home" value=".."/>
13 <property name="build.dir" value="${project.home}/build"/>
14 <property name="lib.dir" value="${project.home}/lib"/>
15 <property environment="env"/>
17 <target name="download.dep">
19 <isset property="proxyhost"/>
21 <setproxy proxyhost="${proxyhost}" proxyport="${proxyport}"/>
25 <isset property="artifact"/>
27 <echo>Getting dependence ${group}/${artifact}/${version}</echo>
28 <dependencies verbose="true" fileSetId="my.deps">
29 <dependency group="${group}" artifact="${artifact}" version="${version}"/>
31 <copy todir="${download.dir}" flatten="yes">
32 <fileset refid="my.deps"/>
36 <echo>Getting dependence ${group}/${version}</echo>
37 <dependencies verbose="true" fileSetId="my.deps">
38 <dependency group="${group}" version="${version}"/>
40 <copy todir="${download.dir}" flatten="yes">
41 <fileset refid="my.deps"/>
48 <target name="log4j.d">
49 <antcall target="download.dep">
50 <param name="group" value="log4j"/>
51 <param name="version" value="1.2.9"/>
55 <target name="commons-beanutils.d">
56 <antcall target="download.dep">
57 <param name="group" value="commons-beanutils"/>
58 <param name="version" value="1.7.0"/>
62 <target name="commons-collections.d">
63 <antcall target="download.dep">
64 <param name="group" value="commons-collections"/>
65 <param name="version" value="3.1"/>
70 <target name="commons-logging.d">
71 <antcall target="download.dep">
72 <param name="group" value="commons-logging"/>
73 <param name="artifact" value="commons-logging"/>
74 <param name="version" value="1.0.2"/>
78 <target name="commons-codec.d">
79 <antcall target="download.dep">
80 <param name="group" value="commons-codec"/>
81 <param name="version" value="1.3"/>
85 <target name="commons-email.d">
86 <antcall target="download.dep">
87 <param name="group" value="commons-email"/>
88 <param name="version" value="1.0"/>
95 <target name="logging.d" depends="log4j.d,commons-logging.d">
98 <target name="dom4j.d">
99 <antcall target="download.dep">
100 <param name="group" value="dom4j"/>
101 <param name="version" value="1.6"/>
103 <antcall target="download.dep">
104 <param name="group" value="jaxen"/>
105 <param name="version" value="1.1-beta-4"/>
109 <target name="ehcache.d">
110 <antcall target="download.dep">
111 <param name="group" value="ehcache"/>
112 <param name="version" value="1.1"/>
116 <target name="xerces.d">
117 <antcall target="download.dep">
118 <param name="group" value="xerces"/>
119 <param name="version" value="2.4.0"/>
123 <target name="oro.d">
124 <antcall target="download.dep">
125 <param name="group" value="oro"/>
126 <param name="version" value="2.0.6"/>
130 <target name="cglib.d">
131 <antcall target="download.dep">
132 <param name="group" value="cglib"/>
133 <param name="version" value="2.1"/>
137 <target name="hibernate.d" depends="cglib.d,oro.d">
138 <antcall target="download.dep">
139 <param name="group" value="hibernate"/>
140 <param name="version" value="3.0.5"/>
144 <target name="hibernate.standalone.d" depends="hibernate.d">
145 <copy todir="${download.dir}">
146 <fileset dir="${special.lib.dir}/hibernate">
147 <include name="*.jar"/>
152 <target name="spring.d">
153 <antcall target="download.dep">
154 <param name="group" value="springframework"/>
155 <param name="artifact" value="spring"/>
156 <param name="version" value="1.2.5"/>
160 <target name="activation.d">
161 <copy todir="${download.dir}">
162 <fileset dir="${special.lib.dir}/jaf-1.0.2">
163 <include name="*.jar"/>
168 <target name="mail.d" depends="activation.d">
169 <copy todir="${download.dir}">
170 <fileset dir="${special.lib.dir}/javamail-1.3.3_01">
171 <include name="*.jar"/>
178 <target name="httpclient.d">
179 <antcall target="download.dep">
180 <param name="group" value="commons-httpclient"/>
181 <param name="version" value="3.0"/>
185 <target name="jtidy.d">
186 <antcall target="download.dep">
187 <param name="group" value="jtidy"/>
188 <param name="version" value="4aug2000r7-dev"/>
192 <property name="support.dist.dir" value="${lib.dir}/wamblee/support"/>
193 <target name="wamblee.support.d">
194 <copy todir="${download.dir}">
195 <fileset dir="${support.dist.dir}">
196 <include name="support.jar"/>
200 <target name="wamblee.support.test.d">
201 <copy todir="${download.dir}">
202 <fileset dir="${support.dist.dir}">
203 <include name="support-test.jar"/>
208 <property name="crawler.dist.dir" value="${lib.dir}/wamblee/crawler/basic"/>
209 <target name="wamblee.crawler.d">
210 <copy todir="${download.dir}">
211 <fileset dir="${crawler.dist.dir}">
212 <include name="crawler-basic.jar"/>
216 <target name="wamblee.crawler.test.d">
217 <copy todir="${download.dir}">
218 <fileset dir="${crawler.dist.dir}">
219 <include name="crawler-basic-test.jar"/>
224 <target name="junit.d">
225 <antcall target="download.dep">
226 <param name="group" value="junit"/>
227 <param name="version" value="3.8.1"/>
229 <copy todir="${download.dir}">
230 <fileset dir="${special.lib.dir}/test">
231 <include name="*.jar"/>
236 <target name="emma.d">
237 <antcall target="download.dep">
238 <param name="group" value="emma"/>
239 <param name="artifact" value="emma"/>
240 <param name="version" value="2.0.5312"/>
242 <antcall target="download.dep">
243 <param name="group" value="emma"/>
244 <param name="artifact" value="emma_ant"/>
245 <param name="version" value="2.0.5312"/>
249 <target name="jmock.d">
250 <antcall target="download.dep">
251 <param name="group" value="jmock"/>
252 <param name="artifact" value="jmock"/>
253 <param name="version" value="1.0.1"/>
255 <antcall target="download.dep">
256 <param name="group" value="jmock"/>
257 <param name="artifact" value="jmock-cglib"/>
258 <param name="version" value="1.0.1"/>
262 <target name="dbunit.d">
263 <antcall target="download.dep">
264 <param name="group" value="dbunit"/>
265 <param name="version" value="2.1"/>
270 <target name="antlr.d">
271 <antcall target="download.dep">
272 <param name="group" value="antlr"/>
273 <param name="version" value="2.7.2"/>
277 <target name="checkstyle.d" depends="antlr.d,commons-beanutils.d,commons-logging.d,commons-collections.d">
278 <antcall target="download.dep">
279 <param name="group" value="checkstyle"/>
280 <param name="version" value="4.1"/>
284 <!-- common test dependencies for all test code -->
285 <target name="test.d" depends="junit.d,jmock.d,dbunit.d,emma.d">
288 <!-- downloaded dependencies for ant tasks -->
289 <target name="ant.d" depends="checkstyle.d">
294 <target name="import_header" unless="build_header_included">
296 <!-- ========================================================================================
297 Locate user properties to (optionally) override defaults
298 ======================================================================================== -->
301 Give user a chance to override without editing this file
302 (and without typing -D each time they run it).
304 The following properties must be defined in this file:
305 - jcoverage.home: root of the jcoverage installation.
306 - jalopy.home: root of the jalopy installation.
308 <property name="user.property.file" value="${user.home}/wamblee.properties"/>
309 <available file="${user.property.file}" property="user.properties.found"/>
310 <property file="${user.property.file}"/>
312 <antcall target="echoUserPropertiesFileFound"/>
313 <antcall target="echoUserPropertiesFileNotFound"/>
315 <!-- project properties defaults, can be overriden in the user's properties file -->
317 <!-- The project.home property can also be overriden in a build.xml
318 in case the source is in a subdirectory and not necessarily
319 in the top-level directory -->
321 <property name="ant.lib.dir" value="${build.dir}/lib/ant"/>
322 <property name="ant.downloaded.lib.dir" value="${build.dir}/lib/ant/downloaded"/>
323 <property name="external.lib.dir" value="lib/external"/>
324 <property name="test.lib.dir" value="lib/test"/>
325 <property name="special.lib.dir" value="${build.dir}/lib/special"/>
326 <property name="build.properties.dir" value="${project.home}" />
327 <property name="build.properties.name" value="build.properties" />
329 <mkdir dir="${external.lib.dir}"/>
330 <mkdir dir="${test.lib.dir}"/>
332 <property name="conf.dir" value="conf"/>
333 <property name="log4j.properties.dir" value="${conf.dir}/properties"/>
335 <!-- Compilation properties -->
336 <property name="javac.debug" value="true"/>
337 <property name="javac.debug.level" value="lines,vars,source"/>
338 <property name="javac.source" value="1.5"/>
340 <!-- ========================================================================================
341 Standard path definitions to be used with all projects
342 ======================================================================================= -->
343 <property name="xmlschemas.dir" value="${conf.dir}/schemas"/>
344 <path id="xmlschemas.path">
345 <pathelement location="${xmlschemas.dir}"/>
348 <!-- ========================================================================================
349 Path definitions for external libraries.
350 ======================================================================================== -->
352 <!-- Ignore system classpath! -->
353 <property name="build.sysclasspath" value="ignore" />
356 <property name="junit.halt.on.failure" value="false"/>
357 <property name="unitreport" value="cl-unit.xml"/>
359 <!-- DocCheck path -->
360 <property name="doccheck.home" value="${ant.lib.dir}/doccheck1.2b2/doccheck.jar"/>
361 <path id="doccheck.path">
362 <pathelement location="${doccheck.home}"/>
365 <!-- PdfDoclet path -->
366 <property name="pdfdoclet.home" value="${ant.lib.dir}/pdfdoclet-1.0.2-all.jar"/>
367 <path id="pdfdoclet.path">
368 <pathelement location="${pdfdoclet.home}"/>
371 <!-- Hibernate paths -->
372 <!-- name of the file in the source directory containing
373 the names of hibernate files to look at in the correct order -->
374 <property name="hibernate.home" value="${lib.dir}/hibernate-3.0"/>
375 <path id="hibernate.basic.path">
376 <fileset dir="${hibernate.home}">
377 <include name="*.jar"/>
379 <path refid="xerces.path"/>
380 <path refid="dom4j.path"/>
382 <path id="hibernate.appserver.path">
383 <path refid="hibernate.basic.path"/>
384 <fileset dir="${hibernate.home}/appserver">
385 <include name="*.jar"/>
388 <path id="hibernate.standalone.path">
389 <path refid="hibernate.basic.path"/>
390 <fileset dir="${hibernate.home}/standalone">
391 <include name="*.jar"/>
395 <!-- Commented the inclusion of a system-wide path in the user's environment into a
396 classpath. System wide classpaths should not be used. -->
397 <!-- property name="classpath_id" value="build.path" / -->
398 <!-- property name="classpath" refid="${classpath_id}"/ -->
399 <property name="classpath" value=""/>
402 <!-- ========================================================================================
404 ======================================================================================== -->
405 <property name="database" value="Derby"/>
407 <!-- ========================================================================================
409 ======================================================================================== -->
411 <!-- ant-contrib integration -->
412 <property name="ant.contrib.home" value="${ant.lib.dir}/ant-contrib-1.0b2"/>
413 <taskdef resource="net/sf/antcontrib/antlib.xml">
415 <pathelement location="${ant.contrib.home}/ant-contrib.jar" />
419 <!-- taskdef for ant-dependencies task -->
420 <taskdef name="dependencies" classpath="${ant.lib.dir}/ant-dependencies.jar"
421 classname="org.apache.tools.ant.taskdefs.optional.dependencies.Dependencies"/>
423 <!-- Emma integration -->
425 <fileset dir="${test.lib.dir}" includes="emma*.jar"/>
427 <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
428 <property name="emma.enabled" value="false"/>
431 <property name="checkstyle.home" value="${ant.downloaded.lib.dir}"/>
432 <taskdef resource="checkstyletask.properties">
434 <fileset dir="${checkstyle.home}">
435 <include name="*.jar"/>
439 <property name="checkstyle.rules" value="style.xml"/>
440 <property name="checkstyle.test.rules" value="test-style.xml"/>
444 <!-- TMP download this dependence as well
445 <property name="jalopy.home" value="${lib.dir}/jalopy-ant-0.6.2"/>
446 <property name="jalopy.rules" value="${build.dir}/formatting-rules.xml"/>
447 <taskdef name="jalopy"
448 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
450 <fileset dir="${jalopy.home}">
451 <include name="*.jar" />
457 <!-- simian integration -->
458 <!-- TMP download this dependence as well
459 <property name="simian.home" value="${lib.dir}/simian"/>
460 <taskdef resource="simiantask.properties" classpath="${simian.home}/simian.jar"/>
463 <!-- macker integration -->
464 <!-- TMP download this dependence as well
465 <property name="macker.home" value="${lib.dir}/macker-0.4.2"/>
466 <path id="macker.path">
467 <fileset dir="${macker.home}">
468 <include name="**/*.jar"/>
471 <taskdef name="macker"
472 classname="net.innig.macker.ant.MackerAntTask"
473 classpathref="macker.path"/>
477 <!-- ========================================================================================
479 ======================================================================================== -->
480 <echo level="debug" message="project.home=${project.home}"/>
481 <echo level="debug" message="project.libs=${project.libs}"/>
482 <echo level="debug" message="classpath=${classpath}"/>
485 <!-- ========================================================================================
487 ======================================================================================== -->
488 <property name="build_header_included" value="true" />
491 <!-- =================================================================
492 Sets up the directory definitions for the module
493 ================================================================= -->
494 <target name="init_directory_properties" depends="import_header">
495 <!-- Set module properties for this build -->
497 <property name="module.home" value="." />
499 <!-- Replace the dash by a / to create a relative directory
500 from a module name -->
501 <propertyregex property="module.reldir"
502 input="${module.name}"
506 defaultValue="${module.name}"/>
507 <!-- property name="module.build.dir"
508 value="${build.dir}/${module.reldir}" / -->
509 <property name="module.build.dir" value="build"/>
510 <property name="module.api.forrest.dir" value="${forrest.build.site.dir}/api/${module.name}" />
511 <property name="module.classes.dir" value="${module.build.dir}/bin" />
512 <property name="module.testclasses.dir" value="${module.build.dir}/testbin" />
513 <!-- Directory where generated SQL will be put by the schema export-->
514 <property name="module.sql.dir" value="${module.build.dir}/sql" />
517 <property name="module.jcovclasses.dir"
518 value="${module.build.dir}/testjcov" />
519 <property name="module.jars.dir" value="${module.build.dir}/jars" />
520 <property name="module.jar.file"
521 value="${module.jars.dir}/${module.jar.name}" />
522 <property name="module.source.dir" value="${module.home}/src" />
523 <property name="module.forrest.src.dir" value="${module.home}/xdocs" />
524 <property name="module.ejbsource.dir" value="${module.home}/ejbsrc" />
525 <property name="module.test.dir" value="${module.home}/test" />
526 <property name="module.testjar.name"
527 value="${module.name}-test.jar" />
528 <property name="module.testresourcesjar.name"
529 value="${module.name}-test-resources.jar" />
530 <property name="module.resource.dir"
531 value="${module.home}/resources" />
532 <property name="module.testresource.dir"
533 value="${module.resource.dir}/test" />
534 <property name="module.testoutput.dir"
535 value="${module.resource.dir}/testoutput"/>
536 <property name="module.report.dir"
537 value="${module.build.dir}/testresults" />
538 <property name="module.emmareport.dir"
539 value="${module.report.dir}/html/emma"/>
540 <property name="module.docbase.dir"
541 value="${module.build.dir}/docs" />
542 <property name="module.javadoc.dir"
543 value="${module.docbase.dir}/api" />
544 <property name="module.javadocjar.name"
545 value="${module.name}-doc.jar" />
546 <property name="module.testjavadocjar.name"
547 value="${module.name}-test-doc.jar" />
548 <property name="module.testjavadoc.dir"
549 value="${module.docbase.dir}/testapi" />
550 <property name="module.pdfdoc.dir"
551 value="${module.docbase.dir}/pdf" />
552 <property name="module.doccheck.dir"
553 value="${module.docbase.dir}/doccheck" />
554 <property name="module.checkstyle.dir"
555 value="${module.docbase.dir}/checkstyle" />
556 <property name="module.jar.name" value="${module.name}.jar" />
558 <!-- Replace the dash by a / to create a relative directory
559 from a module name -->
560 <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
563 <!-- ============================================================================
564 Initialize the environment for other tasks. Normally, every task which
565 does not depend on any other task should at least depend on init.
566 ============================================================================ -->
568 <target name="help" depends="import_header">
569 <antcall target="help-within-module"/>
570 <antcall target="help-outside-module"/>
573 <target name="help-within-module" depends="init_directory_properties" if="module.name">
574 <antcall target="help-impl"/>
577 <target name="help-outside-module" unless="module.name">
578 <antcall target="help-outside-module-2">
579 <param name="module.name" value="MODULE_NAME"/>
583 <target name="help-outside-module-2" depends="init_directory_properties">
584 <antcall target="help-impl"/>
588 <target name="help-impl">
593 To execute with a specific proxy host and port, start ant with the
594 command-line options -Dproxyhost=hostname -Dproxyport=portnumber.
596 deps: Download dependencies, this is necessary for using
597 any of the build targets.
598 clean-deps: Remove downloaded dependencies.
600 General build targets:
602 clean: Cleans up all build results (excluding the dist location).
603 compile: Compiles all java clasess. Target dir ${module.classes.dir}
604 jar: Creates a jar file. Target: ${module.jar.file}
605 dist: Makes the build results available for other modules Target: ${module.dist.dir}.
606 dist-lite: Similar to dist but only creates the jars for code and test code. Useful
607 during development because it takes much less time than the dist
609 clean-dist: Cleans up the dist directories.
613 test: Compile and run tests.
614 junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit)
615 reports: As junit-reports but also generates an emma test coverage
618 Note: By specifying -Dtest=TestCaseName on the ant command line,
619 only the specified testcase will be run.
621 Emma can also be executed manually:
623 emma: Overwrites the production classes by their instrumented versions.
624 emma-reports: Generates emma code coverage reports after running the
625 testcases with instrumented classes.
629 javadoc: Generates javadoc. Target: ${module.javadoc.dir}
630 doccheck: Checks documentation. Target: ${module.doccheck.dir}
634 checkstyle: Checks the style of the code.
635 format: Formats to the code in accordance with the checkstyle rules.
636 simian: Analyse similarities in the code.
640 For all targets below the database is configured using
641 hibernate.properties (hibernate.dialect property) and
642 the JDBC connection properties in database.properties.
644 The schemaexport and schemaupdate targets require the
645 setting of a property named hibernate.filelist. The value
646 of the property must be the fully qualified class name of
647 a concrete subclass of ConfigFileList which has a default
648 public constructor and defines the Hibernate mapping files that
651 schemaexport: Generate SQL code to create the required database structures.
653 startdb: Startup a lightweight database. The database
654 type to start is obtained from the currently
657 schemaupdate: Populate the database with a schema by running
658 Hibernate schemaupdate against the currently