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"/>
16 <target name="download.dep">
18 <isset property="proxyhost"/>
20 <setproxy proxyhost="${proxyhost}" proxyport="${proxyport}"/>
24 <isset property="artifact"/>
26 <echo>Getting dependence ${group}/${artifact}/${version}</echo>
27 <dependencies verbose="true" fileSetId="my.deps">
28 <dependency group="${group}" artifact="${artifact}" version="${version}"/>
30 <copy todir="${download.dir}" flatten="yes">
31 <fileset refid="my.deps"/>
35 <echo>Getting dependence ${group}/${version}</echo>
36 <dependencies verbose="true" fileSetId="my.deps">
37 <dependency group="${group}" version="${version}"/>
39 <copy todir="${download.dir}" flatten="yes">
40 <fileset refid="my.deps"/>
47 <target name="log4j.d">
48 <antcall target="download.dep">
49 <param name="group" value="log4j"/>
50 <param name="version" value="1.2.9"/>
54 <target name="commons-beanutils.d">
55 <antcall target="download.dep">
56 <param name="group" value="commons-beanutils"/>
57 <param name="version" value="1.7.0"/>
61 <target name="commons-collections.d">
62 <antcall target="download.dep">
63 <param name="group" value="commons-collections"/>
64 <param name="version" value="3.1"/>
69 <target name="commons-logging.d">
70 <antcall target="download.dep">
71 <param name="group" value="commons-logging"/>
72 <param name="artifact" value="commons-logging"/>
73 <param name="version" value="1.0.2"/>
77 <target name="commons-codec.d">
78 <antcall target="download.dep">
79 <param name="group" value="commons-codec"/>
80 <param name="version" value="1.3"/>
84 <target name="commons-email.d">
85 <antcall target="download.dep">
86 <param name="group" value="commons-email"/>
87 <param name="version" value="1.0"/>
94 <target name="logging.d" depends="log4j.d,commons-logging.d">
97 <target name="dom4j.d">
98 <antcall target="download.dep">
99 <param name="group" value="dom4j"/>
100 <param name="version" value="1.6"/>
102 <antcall target="download.dep">
103 <param name="group" value="jaxen"/>
104 <param name="version" value="1.1-beta-4"/>
108 <target name="ehcache.d">
109 <antcall target="download.dep">
110 <param name="group" value="ehcache"/>
111 <param name="version" value="1.1"/>
115 <target name="xerces.d">
116 <antcall target="download.dep">
117 <param name="group" value="xerces"/>
118 <param name="version" value="2.4.0"/>
122 <target name="oro.d">
123 <antcall target="download.dep">
124 <param name="group" value="oro"/>
125 <param name="version" value="2.0.6"/>
129 <target name="cglib.d">
130 <antcall target="download.dep">
131 <param name="group" value="cglib"/>
132 <param name="version" value="2.1"/>
136 <target name="hibernate.d" depends="cglib.d,oro.d">
137 <antcall target="download.dep">
138 <param name="group" value="hibernate"/>
139 <param name="version" value="3.0.5"/>
143 <target name="hibernate.standalone.d" depends="hibernate.d">
144 <copy todir="${download.dir}">
145 <fileset dir="${special.lib.dir}/hibernate">
146 <include name="*.jar"/>
151 <target name="spring.d">
152 <antcall target="download.dep">
153 <param name="group" value="springframework"/>
154 <param name="artifact" value="spring"/>
155 <param name="version" value="1.2.5"/>
159 <target name="activation.d">
160 <copy todir="${download.dir}">
161 <fileset dir="${special.lib.dir}/jaf-1.0.2">
162 <include name="*.jar"/>
167 <target name="mail.d" depends="activation.d">
168 <copy todir="${download.dir}">
169 <fileset dir="${special.lib.dir}/javamail-1.3.3_01">
170 <include name="*.jar"/>
177 <target name="httpclient.d">
178 <antcall target="download.dep">
179 <param name="group" value="commons-httpclient"/>
180 <param name="version" value="3.0"/>
184 <target name="jtidy.d">
185 <antcall target="download.dep">
186 <param name="group" value="jtidy"/>
187 <param name="version" value="4aug2000r7-dev"/>
191 <property name="support.dist.dir" value="${lib.dir}/wamblee/support"/>
192 <target name="wamblee.support.d">
193 <copy todir="${download.dir}">
194 <fileset dir="${support.dist.dir}">
195 <include name="support.jar"/>
199 <target name="wamblee.support.test.d">
200 <copy todir="${download.dir}">
201 <fileset dir="${support.dist.dir}">
202 <include name="support-test.jar"/>
207 <property name="crawler.dist.dir" value="${lib.dir}/wamblee/crawler/basic"/>
208 <target name="wamblee.crawler.d">
209 <copy todir="${download.dir}">
210 <fileset dir="${crawler.dist.dir}">
211 <include name="crawler-basic.jar"/>
215 <target name="wamblee.crawler.test.d">
216 <copy todir="${download.dir}">
217 <fileset dir="${crawler.dist.dir}">
218 <include name="crawler-basic-test.jar"/>
223 <target name="junit.d">
224 <antcall target="download.dep">
225 <param name="group" value="junit"/>
226 <param name="version" value="3.8.1"/>
228 <copy todir="${download.dir}">
229 <fileset dir="${special.lib.dir}/test">
230 <include name="*.jar"/>
235 <target name="emma.d">
236 <antcall target="download.dep">
237 <param name="group" value="emma"/>
238 <param name="artifact" value="emma"/>
239 <param name="version" value="2.0.5312"/>
241 <antcall target="download.dep">
242 <param name="group" value="emma"/>
243 <param name="artifact" value="emma_ant"/>
244 <param name="version" value="2.0.5312"/>
248 <target name="jmock.d">
249 <antcall target="download.dep">
250 <param name="group" value="jmock"/>
251 <param name="artifact" value="jmock"/>
252 <param name="version" value="1.0.1"/>
254 <antcall target="download.dep">
255 <param name="group" value="jmock"/>
256 <param name="artifact" value="jmock-cglib"/>
257 <param name="version" value="1.0.1"/>
261 <target name="dbunit.d">
262 <antcall target="download.dep">
263 <param name="group" value="dbunit"/>
264 <param name="version" value="2.1"/>
269 <target name="antlr.d">
270 <antcall target="download.dep">
271 <param name="group" value="antlr"/>
272 <param name="version" value="2.7.2"/>
276 <target name="checkstyle.d" depends="antlr.d,commons-beanutils.d,commons-logging.d,commons-collections.d">
277 <antcall target="download.dep">
278 <param name="group" value="checkstyle"/>
279 <param name="version" value="4.1"/>
283 <!-- common test dependencies for all test code -->
284 <target name="test.d" depends="junit.d,jmock.d,dbunit.d,emma.d">
287 <!-- downloaded dependencies for ant tasks -->
288 <target name="ant.d" depends="checkstyle.d">
293 <target name="import_header" unless="build_header_included">
295 <!-- ========================================================================================
296 Locate user properties to (optionally) override defaults
297 ======================================================================================== -->
300 Give user a chance to override without editing this file
301 (and without typing -D each time they run it).
303 The following properties must be defined in this file:
304 - jcoverage.home: root of the jcoverage installation.
305 - jalopy.home: root of the jalopy installation.
307 <property name="user.property.file" value="${user.home}/wamblee.properties"/>
308 <available file="${user.property.file}" property="user.properties.found"/>
309 <property file="${user.property.file}"/>
311 <antcall target="echoUserPropertiesFileFound"/>
312 <antcall target="echoUserPropertiesFileNotFound"/>
314 <!-- project properties defaults, can be overriden in the user's properties file -->
316 <!-- The project.home property can also be overriden in a build.xml
317 in case the source is in a subdirectory and not necessarily
318 in the top-level directory -->
320 <property name="ant.lib.dir" value="${build.dir}/lib/ant"/>
321 <property name="ant.downloaded.lib.dir" value="${build.dir}/lib/ant/downloaded"/>
322 <property name="external.lib.dir" value="lib/external"/>
323 <property name="test.lib.dir" value="lib/test"/>
324 <property name="special.lib.dir" value="${build.dir}/lib/special"/>
325 <property name="build.properties.dir" value="${project.home}" />
326 <property name="build.properties.name" value="build.properties" />
328 <mkdir dir="${external.lib.dir}"/>
329 <mkdir dir="${test.lib.dir}"/>
331 <property name="conf.dir" value="conf"/>
332 <property name="log4j.properties.dir" value="${conf.dir}/properties"/>
334 <!-- Compilation properties -->
335 <property name="javac.debug" value="true"/>
336 <property name="javac.debug.level" value="lines,vars,source"/>
337 <property name="javac.source" value="1.5"/>
339 <!-- ========================================================================================
340 Standard path definitions to be used with all projects
341 ======================================================================================= -->
342 <property name="xmlschemas.dir" value="${conf.dir}/schemas"/>
343 <path id="xmlschemas.path">
344 <pathelement location="${xmlschemas.dir}"/>
347 <!-- ========================================================================================
348 Path definitions for external libraries.
349 ======================================================================================== -->
351 <!-- Ignore system classpath! -->
352 <property name="build.sysclasspath" value="ignore" />
355 <property name="junit.halt.on.failure" value="false"/>
356 <property name="unitreport" value="cl-unit.xml"/>
358 <!-- DocCheck path -->
359 <property name="doccheck.home" value="${ant.lib.dir}/doccheck1.2b2/doccheck.jar"/>
360 <path id="doccheck.path">
361 <pathelement location="${doccheck.home}"/>
364 <!-- PdfDoclet path -->
365 <property name="pdfdoclet.home" value="${ant.lib.dir}/pdfdoclet-1.0.2-all.jar"/>
366 <path id="pdfdoclet.path">
367 <pathelement location="${pdfdoclet.home}"/>
370 <!-- Hibernate paths -->
371 <!-- name of the file in the source directory containing
372 the names of hibernate files to look at in the correct order -->
373 <property name="hibernate.home" value="${lib.dir}/hibernate-3.0"/>
374 <path id="hibernate.basic.path">
375 <fileset dir="${hibernate.home}">
376 <include name="*.jar"/>
378 <path refid="xerces.path"/>
379 <path refid="dom4j.path"/>
381 <path id="hibernate.appserver.path">
382 <path refid="hibernate.basic.path"/>
383 <fileset dir="${hibernate.home}/appserver">
384 <include name="*.jar"/>
387 <path id="hibernate.standalone.path">
388 <path refid="hibernate.basic.path"/>
389 <fileset dir="${hibernate.home}/standalone">
390 <include name="*.jar"/>
394 <!-- Commented the inclusion of a system-wide path in the user's environment into a
395 classpath. System wide classpaths should not be used. -->
396 <!-- property name="classpath_id" value="build.path" / -->
397 <!-- property name="classpath" refid="${classpath_id}"/ -->
398 <property name="classpath" value=""/>
401 <!-- ========================================================================================
403 ======================================================================================== -->
404 <property name="database" value="Derby"/>
406 <!-- ========================================================================================
408 ======================================================================================== -->
410 <!-- ant-contrib integration -->
411 <property name="ant.contrib.home" value="${ant.lib.dir}/ant-contrib-1.0b2"/>
412 <taskdef resource="net/sf/antcontrib/antlib.xml">
414 <pathelement location="${ant.contrib.home}/ant-contrib.jar" />
418 <!-- taskdef for ant-dependencies task -->
419 <taskdef name="dependencies" classpath="${ant.lib.dir}/ant-dependencies.jar"
420 classname="org.apache.tools.ant.taskdefs.optional.dependencies.Dependencies"/>
422 <!-- Emma integration -->
424 <fileset dir="${test.lib.dir}" includes="emma*.jar"/>
426 <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
427 <property name="emma.enabled" value="false"/>
430 <property name="checkstyle.home" value="${ant.downloaded.lib.dir}"/>
431 <taskdef resource="checkstyletask.properties">
433 <fileset dir="${checkstyle.home}">
434 <include name="*.jar"/>
438 <property name="checkstyle.rules" value="style.xml"/>
439 <property name="checkstyle.test.rules" value="test-style.xml"/>
443 <!-- TMP download this dependence as well
444 <property name="jalopy.home" value="${lib.dir}/jalopy-ant-0.6.2"/>
445 <property name="jalopy.rules" value="${build.dir}/formatting-rules.xml"/>
446 <taskdef name="jalopy"
447 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
449 <fileset dir="${jalopy.home}">
450 <include name="*.jar" />
456 <!-- simian integration -->
457 <!-- TMP download this dependence as well
458 <property name="simian.home" value="${lib.dir}/simian"/>
459 <taskdef resource="simiantask.properties" classpath="${simian.home}/simian.jar"/>
462 <!-- macker integration -->
463 <!-- TMP download this dependence as well
464 <property name="macker.home" value="${lib.dir}/macker-0.4.2"/>
465 <path id="macker.path">
466 <fileset dir="${macker.home}">
467 <include name="**/*.jar"/>
470 <taskdef name="macker"
471 classname="net.innig.macker.ant.MackerAntTask"
472 classpathref="macker.path"/>
476 <!-- ========================================================================================
478 ======================================================================================== -->
479 <echo level="debug" message="project.home=${project.home}"/>
480 <echo level="debug" message="project.libs=${project.libs}"/>
481 <echo level="debug" message="classpath=${classpath}"/>
484 <!-- ========================================================================================
486 ======================================================================================== -->
487 <property name="build_header_included" value="true" />
490 <!-- =================================================================
491 Sets up the directory definitions for the module
492 ================================================================= -->
493 <target name="init_directory_properties" depends="import_header">
494 <!-- Set module properties for this build -->
496 <property name="module.home" value="." />
498 <!-- Replace the dash by a / to create a relative directory
499 from a module name -->
500 <propertyregex property="module.reldir"
501 input="${module.name}"
505 defaultValue="${module.name}"/>
506 <!-- property name="module.build.dir"
507 value="${build.dir}/${module.reldir}" / -->
508 <property name="module.build.dir" value="build"/>
509 <property name="module.api.forrest.dir" value="${forrest.build.site.dir}/api/${module.name}" />
510 <property name="module.classes.dir" value="${module.build.dir}/bin" />
511 <property name="module.testclasses.dir" value="${module.build.dir}/testbin" />
512 <!-- Directory where generated SQL will be put by the schema export-->
513 <property name="module.sql.dir" value="${module.build.dir}/sql" />
516 <property name="module.jcovclasses.dir"
517 value="${module.build.dir}/testjcov" />
518 <property name="module.jars.dir" value="${module.build.dir}/jars" />
519 <property name="module.jar.file"
520 value="${module.jars.dir}/${module.jar.name}" />
521 <property name="module.source.dir" value="${module.home}/src" />
522 <property name="module.forrest.src.dir" value="${module.home}/xdocs" />
523 <property name="module.ejbsource.dir" value="${module.home}/ejbsrc" />
524 <property name="module.test.dir" value="${module.home}/test" />
525 <property name="module.testjar.name"
526 value="${module.name}-test.jar" />
527 <property name="module.testresourcesjar.name"
528 value="${module.name}-test-resources.jar" />
529 <property name="module.resource.dir"
530 value="${module.home}/resources" />
531 <property name="module.testresource.dir"
532 value="${module.resource.dir}/test" />
533 <property name="module.testoutput.dir"
534 value="${module.resource.dir}/testoutput"/>
535 <property name="module.report.dir"
536 value="${module.build.dir}/testresults" />
537 <property name="module.emmareport.dir"
538 value="${module.report.dir}/html/emma"/>
539 <property name="module.docbase.dir"
540 value="${module.build.dir}/docs" />
541 <property name="module.javadoc.dir"
542 value="${module.docbase.dir}/api" />
543 <property name="module.javadocjar.name"
544 value="${module.name}-doc.jar" />
545 <property name="module.testjavadocjar.name"
546 value="${module.name}-test-doc.jar" />
547 <property name="module.testjavadoc.dir"
548 value="${module.docbase.dir}/testapi" />
549 <property name="module.pdfdoc.dir"
550 value="${module.docbase.dir}/pdf" />
551 <property name="module.doccheck.dir"
552 value="${module.docbase.dir}/doccheck" />
553 <property name="module.checkstyle.dir"
554 value="${module.docbase.dir}/checkstyle" />
555 <property name="module.jar.name" value="${module.name}.jar" />
557 <!-- Replace the dash by a / to create a relative directory
558 from a module name -->
559 <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
562 <!-- ============================================================================
563 Initialize the environment for other tasks. Normally, every task which
564 does not depend on any other task should at least depend on init.
565 ============================================================================ -->
567 <target name="help" depends="import_header">
568 <antcall target="help-within-module"/>
569 <antcall target="help-outside-module"/>
572 <target name="help-within-module" depends="init_directory_properties" if="module.name">
573 <antcall target="help-impl"/>
576 <target name="help-outside-module" unless="module.name">
577 <antcall target="help-outside-module-2">
578 <param name="module.name" value="MODULE_NAME"/>
582 <target name="help-outside-module-2" depends="init_directory_properties">
583 <antcall target="help-impl"/>
587 <target name="help-impl">
592 To execute with a specific proxy host and port, start ant with the
593 command-line options -Dproxyhost=hostname -Dproxyport=portnumber.
595 deps: Download dependencies, this is necessary for using
596 any of the build targets.
597 clean-deps: Remove downloaded dependencies.
599 General build targets:
601 clean: Cleans up all build results (excluding the dist location).
602 compile: Compiles all java clasess. Target dir ${module.classes.dir}
603 jar: Creates a jar file. Target: ${module.jar.file}
604 dist: Makes the build results available for other modules Target: ${module.dist.dir}.
605 dist-lite: Similar to dist but only creates the jars for code and test code. Useful
606 during development because it takes much less time than the dist
608 clean-dist: Cleans up the dist directories.
612 test: Compile and run tests.
613 junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit)
614 reports: As junit-reports but also generates an emma test coverage
617 Note: By specifying -Dtest=TestCaseName on the ant command line,
618 only the specified testcase will be run.
620 Emma can also be executed manually:
622 emma: Overwrites the production classes by their instrumented versions.
623 emma-reports: Generates emma code coverage reports after running the
624 testcases with instrumented classes.
628 javadoc: Generates javadoc. Target: ${module.javadoc.dir}
629 doccheck: Checks documentation. Target: ${module.doccheck.dir}
633 checkstyle: Checks the style of the code.
634 format: Formats to the code in accordance with the checkstyle rules.
635 simian: Analyse similarities in the code.
639 For all targets below the database is configured using
640 hibernate.properties (hibernate.dialect property) and
641 the JDBC connection properties in database.properties.
643 The schemaexport and schemaupdate targets require the
644 setting of a property named hibernate.filelist. The value
645 of the property must be the fully qualified class name of
646 a concrete subclass of ConfigFileList which has a default
647 public constructor and defines the Hibernate mapping files that
650 schemaexport: Generate SQL code to create the required database structures.
652 startdb: Startup a lightweight database. The database
653 type to start is obtained from the currently
656 schemaupdate: Populate the database with a schema by running
657 Hibernate schemaupdate against the currently