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/wamblee"/>
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}/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}/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="${project.home}/lib/ant"/>
321 <property name="ant.downloaded.lib.dir" value="${project.home}/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="${project.home}/lib/special"/>
325 <property name="forrest.xdocs.dir" value="${project.home}/site/xdocs"/>
326 <property name="forrest.build.dir" value="${project.home}/site/build"/>
327 <property name="forrest.build.site.dir" value="${forrest.build.dir}/site"/>
328 <property name="build.properties.dir" value="${project.home}" />
329 <property name="build.properties.name" value="build.properties" />
331 <mkdir dir="${external.lib.dir}"/>
332 <mkdir dir="${test.lib.dir}"/>
334 <property name="conf.dir" value="conf"/>
335 <property name="log4j.properties.dir" value="${conf.dir}/properties"/>
337 <!-- Compilation properties -->
338 <property name="javac.debug" value="true"/>
339 <property name="javac.debug.level" value="lines,vars,source"/>
340 <property name="javac.source" value="1.5"/>
342 <!-- ========================================================================================
343 Standard path definitions to be used with all projects
344 ======================================================================================= -->
345 <property name="xmlschemas.dir" value="${conf.dir}/schemas"/>
346 <path id="xmlschemas.path">
347 <pathelement location="${xmlschemas.dir}"/>
350 <!-- ========================================================================================
351 Path definitions for external libraries.
352 ======================================================================================== -->
354 <!-- Ignore system classpath! -->
355 <property name="build.sysclasspath" value="ignore" />
358 <property name="junit.halt.on.failure" value="false"/>
359 <property name="unitreport" value="cl-unit.xml"/>
361 <!-- DocCheck path -->
362 <property name="doccheck.home" value="${ant.lib.dir}/doccheck1.2b2/doccheck.jar"/>
363 <path id="doccheck.path">
364 <pathelement location="${doccheck.home}"/>
367 <!-- PdfDoclet path -->
368 <property name="pdfdoclet.home" value="${ant.lib.dir}/pdfdoclet-1.0.2-all.jar"/>
369 <path id="pdfdoclet.path">
370 <pathelement location="${pdfdoclet.home}"/>
373 <!-- Hibernate paths -->
374 <!-- name of the file in the source directory containing
375 the names of hibernate files to look at in the correct order -->
376 <property name="hibernate.home" value="${lib.dir}/hibernate-3.0"/>
377 <path id="hibernate.basic.path">
378 <fileset dir="${hibernate.home}">
379 <include name="*.jar"/>
381 <path refid="xerces.path"/>
382 <path refid="dom4j.path"/>
384 <path id="hibernate.appserver.path">
385 <path refid="hibernate.basic.path"/>
386 <fileset dir="${hibernate.home}/appserver">
387 <include name="*.jar"/>
390 <path id="hibernate.standalone.path">
391 <path refid="hibernate.basic.path"/>
392 <fileset dir="${hibernate.home}/standalone">
393 <include name="*.jar"/>
397 <!-- Commented the inclusion of a system-wide path in the user's environment into a
398 classpath. System wide classpaths should not be used. -->
399 <!-- property name="classpath_id" value="build.path" / -->
400 <!-- property name="classpath" refid="${classpath_id}"/ -->
401 <property name="classpath" value=""/>
404 <!-- ========================================================================================
406 ======================================================================================== -->
407 <property name="database" value="Derby"/>
409 <!-- ========================================================================================
411 ======================================================================================== -->
413 <!-- ant-contrib integration -->
414 <property name="ant.contrib.home" value="${ant.lib.dir}/ant-contrib-1.0b2"/>
415 <taskdef resource="net/sf/antcontrib/antlib.xml">
417 <pathelement location="${ant.contrib.home}/ant-contrib.jar" />
421 <!-- taskdef for ant-dependencies task -->
422 <taskdef name="dependencies" classpath="${ant.lib.dir}/ant-dependencies.jar"
423 classname="org.apache.tools.ant.taskdefs.optional.dependencies.Dependencies"/>
425 <!-- Emma integration -->
427 <fileset dir="${test.lib.dir}" includes="emma*.jar"/>
429 <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
430 <property name="emma.enabled" value="false"/>
433 <property name="checkstyle.home" value="${ant.downloaded.lib.dir}"/>
434 <taskdef resource="checkstyletask.properties">
436 <fileset dir="${checkstyle.home}">
437 <include name="*.jar"/>
441 <property name="checkstyle.rules" value="style.xml"/>
442 <property name="checkstyle.test.rules" value="test-style.xml"/>
446 <!-- TMP download this dependence as well
447 <property name="jalopy.home" value="${lib.dir}/jalopy-ant-0.6.2"/>
448 <property name="jalopy.rules" value="${build.dir}/formatting-rules.xml"/>
449 <taskdef name="jalopy"
450 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
452 <fileset dir="${jalopy.home}">
453 <include name="*.jar" />
459 <!-- simian integration -->
460 <!-- TMP download this dependence as well
461 <property name="simian.home" value="${lib.dir}/simian"/>
462 <taskdef resource="simiantask.properties" classpath="${simian.home}/simian.jar"/>
465 <!-- macker integration -->
466 <!-- TMP download this dependence as well
467 <property name="macker.home" value="${lib.dir}/macker-0.4.2"/>
468 <path id="macker.path">
469 <fileset dir="${macker.home}">
470 <include name="**/*.jar"/>
473 <taskdef name="macker"
474 classname="net.innig.macker.ant.MackerAntTask"
475 classpathref="macker.path"/>
479 <!-- ========================================================================================
481 ======================================================================================== -->
482 <echo level="debug" message="project.home=${project.home}"/>
483 <echo level="debug" message="project.libs=${project.libs}"/>
484 <echo level="debug" message="classpath=${classpath}"/>
487 <!-- ========================================================================================
489 ======================================================================================== -->
490 <property name="build_header_included" value="true" />
493 <!-- =================================================================
494 Sets up the directory definitions for the module
495 ================================================================= -->
496 <target name="init_directory_properties" depends="import_header">
497 <!-- Set module properties for this build -->
499 <property name="module.home" value="." />
501 <!-- Replace the dash by a / to create a relative directory
502 from a module name -->
503 <propertyregex property="module.reldir"
504 input="${module.name}"
508 defaultValue="${module.name}"/>
509 <property name="module.build.dir"
510 value="${build.dir}/${module.reldir}" />
512 <property name="module.api.forrest.dir" value="${forrest.build.site.dir}/api/${module.name}" />
513 <!-- property name="module.classes.dir" value="${module.build.dir}/bin"/ -->
514 <!-- property name="module.testclasses.dir" value="${module.build.dir}/testbin"/ -->
515 <property name="module.classes.dir" value="bin" />
516 <property name="module.testclasses.dir" value="testbin" />
517 <!-- Directory where generated SQL will be put by the schema export-->
518 <property name="module.sql.dir" value="${module.build.dir}/sql" />
521 <property name="module.jcovclasses.dir"
522 value="${module.build.dir}/testjcov" />
523 <property name="module.jars.dir" value="${module.build.dir}/jars" />
524 <property name="module.jar.file"
525 value="${module.jars.dir}/${module.jar.name}" />
526 <property name="module.source.dir" value="${module.home}/src" />
527 <property name="module.forrest.src.dir" value="${module.home}/xdocs" />
528 <property name="module.ejbsource.dir" value="${module.home}/ejbsrc" />
529 <property name="module.test.dir" value="${module.home}/test" />
530 <property name="module.testjar.name"
531 value="${module.name}-test.jar" />
532 <property name="module.testresourcesjar.name"
533 value="${module.name}-test-resources.jar" />
534 <property name="module.resource.dir"
535 value="${module.home}/resources" />
536 <property name="module.testresource.dir"
537 value="${module.resource.dir}/test" />
538 <property name="module.testoutput.dir"
539 value="${module.resource.dir}/testoutput"/>
540 <property name="module.report.dir"
541 value="${module.build.dir}/testresults" />
542 <property name="module.emmareport.dir"
543 value="${module.report.dir}/html/emma"/>
544 <property name="module.docbase.dir"
545 value="${module.build.dir}/docs" />
546 <property name="module.javadoc.dir"
547 value="${module.docbase.dir}/api" />
548 <property name="module.javadocjar.name"
549 value="${module.name}-doc.jar" />
550 <property name="module.testjavadocjar.name"
551 value="${module.name}-test-doc.jar" />
552 <property name="module.testjavadoc.dir"
553 value="${module.docbase.dir}/testapi" />
554 <property name="module.pdfdoc.dir"
555 value="${module.docbase.dir}/pdf" />
556 <property name="module.doccheck.dir"
557 value="${module.docbase.dir}/doccheck" />
558 <property name="module.checkstyle.dir"
559 value="${module.docbase.dir}/checkstyle" />
560 <property name="module.jar.name" value="${module.name}.jar" />
562 <!-- Replace the dash by a / to create a relative directory
563 from a module name -->
564 <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
567 <!-- ============================================================================
568 Initialize the environment for other tasks. Normally, every task which
569 does not depend on any other task should at least depend on init.
570 ============================================================================ -->
572 <target name="help" depends="import_header">
573 <antcall target="help-within-module"/>
574 <antcall target="help-outside-module"/>
577 <target name="help-within-module" depends="init_directory_properties" if="module.name">
578 <antcall target="help-impl"/>
581 <target name="help-outside-module" unless="module.name">
582 <antcall target="help-outside-module-2">
583 <param name="module.name" value="MODULE_NAME"/>
587 <target name="help-outside-module-2" depends="init_directory_properties">
588 <antcall target="help-impl"/>
592 <target name="help-impl">
597 To execute with a specific proxy host and port, start ant with the
598 command-line options -Dproxyhost=hostname -Dproxyport=portnumber.
600 deps: Download dependencies, this is necessary for using
601 any of the build targets.
602 clean-deps: Remove downloaded dependencies.
604 General build targets:
606 clean: Cleans up all build results (excluding the dist location).
607 compile: Compiles all java clasess. Target dir ${module.classes.dir}
608 jar: Creates a jar file. Target: ${module.jar.file}
609 dist: Makes the build results available for other modules Target: ${module.dist.dir}.
610 dist-lite: Similar to dist but only creates the jars for code and test code. Useful
611 during development because it takes much less time than the dist
613 clean-dist: Cleans up the dist directories.
617 test: Compile and run tests.
618 junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit)
619 reports: As junit-reports but also generates an emma test coverage
622 Note: By specifying -Dtest=TestCaseName on the ant command line,
623 only the specified testcase will be run.
625 Emma can also be executed manually:
627 emma: Overwrites the production classes by their instrumented versions.
628 emma-reports: Generates emma code coverage reports after running the
629 testcases with instrumented classes.
633 javadoc: Generates javadoc. Target: ${module.javadoc.dir}
634 doccheck: Checks documentation. Target: ${module.doccheck.dir}
638 checkstyle: Checks the style of the code.
639 format: Formats to the code in accordance with the checkstyle rules.
640 simian: Analyse similarities in the code.
644 For all targets below the database is configured using
645 hibernate.properties (hibernate.dialect property) and
646 the JDBC connection properties in database.properties.
648 The schemaexport and schemaupdate targets require the
649 setting of a property named hibernate.filelist. The value
650 of the property must be the fully qualified class name of
651 a concrete subclass of ConfigFileList which has a default
652 public constructor and defines the Hibernate mapping files that
655 schemaexport: Generate SQL code to create the required database structures.
657 startdb: Startup a lightweight database. The database
658 type to start is obtained from the currently
661 schemaupdate: Populate the database with a schema by running
662 Hibernate schemaupdate against the currently