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"/>
85 <target name="logging.d" depends="log4j.d,commons-logging.d">
88 <target name="dom4j.d">
89 <antcall target="download.dep">
90 <param name="group" value="dom4j"/>
91 <param name="version" value="1.6"/>
93 <antcall target="download.dep">
94 <param name="group" value="jaxen"/>
95 <param name="version" value="1.1-beta-4"/>
99 <target name="xerces.d">
100 <antcall target="download.dep">
101 <param name="group" value="ehcache"/>
102 <param name="version" value="1.1"/>
106 <target name="ehcache.d">
107 <antcall target="download.dep">
108 <param name="group" value="xerces"/>
109 <param name="version" value="2.4.0"/>
113 <target name="oro.d">
114 <antcall target="download.dep">
115 <param name="group" value="oro"/>
116 <param name="version" value="2.0.6"/>
120 <target name="cglib.d">
121 <antcall target="download.dep">
122 <param name="group" value="cglib"/>
123 <param name="version" value="2.1"/>
127 <target name="hibernate.d" depends="cglib.d,oro.d">
128 <antcall target="download.dep">
129 <param name="group" value="hibernate"/>
130 <param name="version" value="3.0.5"/>
134 <target name="hibernate.standalone.d" depends="hibernate.d">
135 <copy todir="${download.dir}">
136 <fileset dir="${special.lib.dir}/hibernate">
137 <include name="*.jar"/>
142 <target name="spring.d">
143 <antcall target="download.dep">
144 <param name="group" value="springframework"/>
145 <param name="artifact" value="spring"/>
146 <param name="version" value="1.2.5"/>
150 <target name="activation.d">
151 <copy todir="${download.dir}">
152 <fileset dir="${special.lib.dir}/jaf-1.0.2">
153 <include name="*.jar"/>
158 <target name="mail.d" depends="activation.d">
159 <copy todir="${download.dir}">
160 <fileset dir="${special.lib.dir}/javamail-1.3.3_01">
161 <include name="*.jar"/>
168 <target name="httpclient.d">
169 <antcall target="download.dep">
170 <param name="group" value="commons-httpclient"/>
171 <param name="version" value="3.0"/>
175 <target name="jtidy.d">
176 <antcall target="download.dep">
177 <param name="group" value="jtidy"/>
178 <param name="version" value="4aug2000r7-dev"/>
182 <property name="support.dist.dir" value="${lib.dir}/support"/>
183 <target name="wamblee.support.d">
184 <copy todir="${download.dir}">
185 <fileset dir="${support.dist.dir}">
186 <include name="support.jar"/>
190 <target name="wamblee.support.test.d">
191 <copy todir="${download.dir}">
192 <fileset dir="${support.dist.dir}">
193 <include name="support-test.jar"/>
198 <property name="crawler.dist.dir" value="${lib.dir}/crawler"/>
199 <target name="wamblee.crawler.d">
200 <copy todir="${download.dir}">
201 <fileset dir="${crawler.dist.dir}">
202 <include name="crawler.jar"/>
206 <target name="wamblee.crawler.test.d">
207 <copy todir="${download.dir}">
208 <fileset dir="${crawler.dist.dir}">
209 <include name="crawler-test.jar"/>
214 <target name="junit.d">
215 <antcall target="download.dep">
216 <param name="group" value="junit"/>
217 <param name="version" value="3.8.1"/>
219 <copy todir="${download.dir}">
220 <fileset dir="${special.lib.dir}/test">
221 <include name="*.jar"/>
226 <target name="emma.d">
227 <antcall target="download.dep">
228 <param name="group" value="emma"/>
229 <param name="artifact" value="emma"/>
230 <param name="version" value="2.0.5312"/>
232 <antcall target="download.dep">
233 <param name="group" value="emma"/>
234 <param name="artifact" value="emma_ant"/>
235 <param name="version" value="2.0.5312"/>
239 <target name="jmock.d">
240 <antcall target="download.dep">
241 <param name="group" value="jmock"/>
242 <param name="artifact" value="jmock"/>
243 <param name="version" value="1.0.1"/>
245 <antcall target="download.dep">
246 <param name="group" value="jmock"/>
247 <param name="artifact" value="jmock-cglib"/>
248 <param name="version" value="1.0.1"/>
252 <target name="dbunit.d">
253 <antcall target="download.dep">
254 <param name="group" value="dbunit"/>
255 <param name="version" value="2.1"/>
260 <target name="antlr.d">
261 <antcall target="download.dep">
262 <param name="group" value="antlr"/>
263 <param name="version" value="2.7.2"/>
267 <target name="checkstyle.d" depends="antlr.d,commons-beanutils.d,commons-logging.d,commons-collections.d">
268 <antcall target="download.dep">
269 <param name="group" value="checkstyle"/>
270 <param name="version" value="4.1"/>
274 <!-- common test dependencies for all test code -->
275 <target name="test.d" depends="junit.d,jmock.d,dbunit.d,emma.d">
278 <!-- downloaded dependencies for ant tasks -->
279 <target name="ant.d" depends="checkstyle.d">
284 <target name="import_header" unless="build_header_included">
286 <!-- ========================================================================================
287 Locate user properties to (optionally) override defaults
288 ======================================================================================== -->
291 Give user a chance to override without editing this file
292 (and without typing -D each time they run it).
294 The following properties must be defined in this file:
295 - jcoverage.home: root of the jcoverage installation.
296 - jalopy.home: root of the jalopy installation.
298 <property name="user.property.file" value="${user.home}/wamblee.properties"/>
299 <available file="${user.property.file}" property="user.properties.found"/>
300 <property file="${user.property.file}"/>
302 <antcall target="echoUserPropertiesFileFound"/>
303 <antcall target="echoUserPropertiesFileNotFound"/>
305 <!-- project properties defaults, can be overriden in the user's properties file -->
307 <!-- The project.home property can also be overriden in a build.xml
308 in case the source is in a subdirectory and not necessarily
309 in the top-level directory -->
311 <property name="ant.lib.dir" value="${project.home}/lib/ant"/>
312 <property name="ant.downloaded.lib.dir" value="${project.home}/lib/ant/downloaded"/>
313 <property name="external.lib.dir" value="lib/external"/>
314 <property name="test.lib.dir" value="lib/test"/>
315 <property name="special.lib.dir" value="${project.home}/lib/special"/>
316 <property name="forrest.xdocs.dir" value="${project.home}/site/xdocs"/>
317 <property name="forrest.build.dir" value="${project.home}/site/build"/>
318 <property name="forrest.build.site.dir" value="${forrest.build.dir}/site"/>
319 <property name="build.properties.dir" value="${project.home}" />
320 <property name="build.properties.name" value="build.properties" />
322 <mkdir dir="${external.lib.dir}"/>
323 <mkdir dir="${test.lib.dir}"/>
325 <property name="conf.dir" value="conf"/>
326 <property name="log4j.properties.dir" value="${conf.dir}/properties"/>
328 <!-- Compilation properties -->
329 <property name="javac.debug" value="true"/>
330 <property name="javac.debug.level" value="lines,vars,source"/>
331 <property name="javac.source" value="1.5"/>
333 <!-- ========================================================================================
334 Standard path definitions to be used with all projects
335 ======================================================================================= -->
336 <property name="xmlschemas.dir" value="${conf.dir}/schemas"/>
337 <path id="xmlschemas.path">
338 <pathelement location="${xmlschemas.dir}"/>
341 <!-- ========================================================================================
342 Path definitions for external libraries.
343 ======================================================================================== -->
345 <!-- Ignore system classpath! -->
346 <property name="build.sysclasspath" value="ignore" />
349 <property name="junit.halt.on.failure" value="false"/>
350 <property name="unitreport" value="cl-unit.xml"/>
352 <!-- DocCheck path -->
353 <property name="doccheck.home" value="${ant.lib.dir}/doccheck1.2b2/doccheck.jar"/>
354 <path id="doccheck.path">
355 <pathelement location="${doccheck.home}"/>
358 <!-- PdfDoclet path -->
359 <property name="pdfdoclet.home" value="${ant.lib.dir}/pdfdoclet-1.0.2-all.jar"/>
360 <path id="pdfdoclet.path">
361 <pathelement location="${pdfdoclet.home}"/>
364 <!-- Hibernate paths -->
365 <!-- name of the file in the source directory containing
366 the names of hibernate files to look at in the correct order -->
367 <property name="hibernate.home" value="${lib.dir}/hibernate-3.0"/>
368 <path id="hibernate.basic.path">
369 <fileset dir="${hibernate.home}">
370 <include name="*.jar"/>
372 <path refid="xerces.path"/>
373 <path refid="dom4j.path"/>
375 <path id="hibernate.appserver.path">
376 <path refid="hibernate.basic.path"/>
377 <fileset dir="${hibernate.home}/appserver">
378 <include name="*.jar"/>
381 <path id="hibernate.standalone.path">
382 <path refid="hibernate.basic.path"/>
383 <fileset dir="${hibernate.home}/standalone">
384 <include name="*.jar"/>
388 <!-- Commented the inclusion of a system-wide path in the user's environment into a
389 classpath. System wide classpaths should not be used. -->
390 <!-- property name="classpath_id" value="build.path" / -->
391 <!-- property name="classpath" refid="${classpath_id}"/ -->
392 <property name="classpath" value=""/>
395 <!-- ========================================================================================
397 ======================================================================================== -->
398 <property name="database" value="Derby"/>
400 <!-- ========================================================================================
402 ======================================================================================== -->
404 <!-- ant-contrib integration -->
405 <property name="ant.contrib.home" value="${ant.lib.dir}/ant-contrib-1.0b2"/>
406 <taskdef resource="net/sf/antcontrib/antlib.xml">
408 <pathelement location="${ant.contrib.home}/ant-contrib.jar" />
412 <!-- taskdef for ant-dependencies task -->
413 <taskdef name="dependencies" classpath="${ant.lib.dir}/ant-dependencies.jar"
414 classname="org.apache.tools.ant.taskdefs.optional.dependencies.Dependencies"/>
416 <!-- Emma integration -->
418 <fileset dir="${test.lib.dir}" includes="emma*.jar"/>
420 <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
421 <property name="emma.enabled" value="false"/>
424 <property name="checkstyle.home" value="${ant.downloaded.lib.dir}"/>
425 <taskdef resource="checkstyletask.properties">
427 <fileset dir="${checkstyle.home}">
428 <include name="*.jar"/>
432 <property name="checkstyle.rules" value="style.xml"/>
433 <property name="checkstyle.test.rules" value="test-style.xml"/>
437 <!-- TMP download this dependence as well
438 <property name="jalopy.home" value="${lib.dir}/jalopy-ant-0.6.2"/>
439 <property name="jalopy.rules" value="${build.dir}/formatting-rules.xml"/>
440 <taskdef name="jalopy"
441 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
443 <fileset dir="${jalopy.home}">
444 <include name="*.jar" />
450 <!-- simian integration -->
451 <!-- TMP download this dependence as well
452 <property name="simian.home" value="${lib.dir}/simian"/>
453 <taskdef resource="simiantask.properties" classpath="${simian.home}/simian.jar"/>
456 <!-- macker integration -->
457 <!-- TMP download this dependence as well
458 <property name="macker.home" value="${lib.dir}/macker-0.4.2"/>
459 <path id="macker.path">
460 <fileset dir="${macker.home}">
461 <include name="**/*.jar"/>
464 <taskdef name="macker"
465 classname="net.innig.macker.ant.MackerAntTask"
466 classpathref="macker.path"/>
470 <!-- ========================================================================================
472 ======================================================================================== -->
473 <echo level="debug" message="project.home=${project.home}"/>
474 <echo level="debug" message="project.libs=${project.libs}"/>
475 <echo level="debug" message="classpath=${classpath}"/>
478 <!-- ========================================================================================
480 ======================================================================================== -->
481 <property name="build_header_included" value="true" />
484 <!-- =================================================================
485 Sets up the directory definitions for the module
486 ================================================================= -->
487 <target name="init_directory_properties" depends="import_header">
488 <!-- Set module properties for this build -->
490 <property name="module.home" value="." />
492 <!-- Replace the dash by a / to create a relative directory
493 from a module name -->
494 <propertyregex property="module.reldir"
495 input="${module.name}"
499 defaultValue="${module.name}"/>
500 <property name="module.build.dir"
501 value="${build.dir}/${module.reldir}" />
503 <property name="module.api.forrest.dir" value="${forrest.build.site.dir}/api/${module.name}" />
504 <!-- property name="module.classes.dir" value="${module.build.dir}/bin"/ -->
505 <!-- property name="module.testclasses.dir" value="${module.build.dir}/testbin"/ -->
506 <property name="module.classes.dir" value="bin" />
507 <property name="module.testclasses.dir" value="testbin" />
508 <!-- Directory where generated SQL will be put by the schema export-->
509 <property name="module.sql.dir" value="${module.build.dir}/sql" />
512 <property name="module.jcovclasses.dir"
513 value="${module.build.dir}/testjcov" />
514 <property name="module.jars.dir" value="${module.build.dir}/jars" />
515 <property name="module.jar.file"
516 value="${module.jars.dir}/${module.jar.name}" />
517 <property name="module.source.dir" value="${module.home}/src" />
518 <property name="module.forrest.src.dir" value="${module.home}/xdocs" />
519 <property name="module.ejbsource.dir" value="${module.home}/ejbsrc" />
520 <property name="module.test.dir" value="${module.home}/test" />
521 <property name="module.testjar.name"
522 value="${module.name}-test.jar" />
523 <property name="module.testresourcesjar.name"
524 value="${module.name}-test-resources.jar" />
525 <property name="module.resource.dir"
526 value="${module.home}/resources" />
527 <property name="module.testresource.dir"
528 value="${module.resource.dir}/test" />
529 <property name="module.testoutput.dir"
530 value="${module.resource.dir}/testoutput"/>
531 <property name="module.report.dir"
532 value="${module.build.dir}/testresults" />
533 <property name="module.emmareport.dir"
534 value="${module.report.dir}/html/emma"/>
535 <property name="module.docbase.dir"
536 value="${module.build.dir}/javadoc" />
537 <property name="module.javadoc.dir"
538 value="${module.docbase.dir}/api" />
539 <property name="module.javadocjar.name"
540 value="${module.name}-doc.jar" />
541 <property name="module.testjavadocjar.name"
542 value="${module.name}-test-doc.jar" />
543 <property name="module.testjavadoc.dir"
544 value="${module.docbase.dir}/testapi" />
545 <property name="module.pdfdoc.dir"
546 value="${module.docbase.dir}/pdf" />
547 <property name="module.doccheck.dir"
548 value="${module.docbase.dir}/doccheck" />
549 <property name="module.jar.name" value="${module.name}.jar" />
551 <!-- Replace the dash by a / to create a relative directory
552 from a module name -->
553 <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
556 <!-- ============================================================================
557 Initialize the environment for other tasks. Normally, every task which
558 does not depend on any other task should at least depend on init.
559 ============================================================================ -->
561 <target name="help" depends="import_header">
562 <antcall target="help-within-module"/>
563 <antcall target="help-outside-module"/>
566 <target name="help-within-module" depends="init_directory_properties" if="module.name">
567 <antcall target="help-impl"/>
570 <target name="help-outside-module" unless="module.name">
571 <antcall target="help-outside-module-2">
572 <param name="module.name" value="MODULE_NAME"/>
576 <target name="help-outside-module-2" depends="init_directory_properties">
577 <antcall target="help-impl"/>
581 <target name="help-impl">
586 To execute with a specific proxy host and port, start ant with the
587 command-line options -Dproxyhost=hostname -Dproxyport=portnumber.
589 deps: Download dependencies, this is necessary for using
590 any of the build targets.
591 clean-deps: Remove downloaded dependencies.
593 General build targets:
595 clean: Cleans up all build results (excluding the dist location).
596 compile: Compiles all java clasess. Target dir ${module.classes.dir}
597 jar: Creates a jar file. Target: ${module.jar.file}
598 dist: Makes the build results available for other modules Target: ${module.dist.dir}.
599 dist-lite: Similar to dist but only creates the jars for code and test code. Useful
600 during development because it takes much less time than the dist
602 clean-dist: Cleans up the dist directories.
606 test: Compile and run tests.
607 junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit)
608 reports: As junit-reports but also generates an emma test coverage
611 Note: By specifying -Dtest=TestCaseName on the ant command line,
612 only the specified testcase will be run.
614 Emma can also be executed manually:
616 emma: Overwrites the production classes by their instrumented versions.
617 emma-reports: Generates emma code coverage reports after running the
618 testcases with instrumented classes.
622 javadoc: Generates javadoc. Target: ${module.javadoc.dir}
623 doccheck: Checks documentation. Target: ${module.doccheck.dir}
627 checkstyle: Checks the style of the code.
628 format: Formats to the code in accordance with the checkstyle rules.
629 simian: Analyse similarities in the code.
633 For all targets below the database is configured using
634 hibernate.properties (hibernate.dialect property) and
635 the JDBC connection properties in database.properties.
637 The schemaexport and schemaupdate targets require the
638 setting of a property named hibernate.filelist. The value
639 of the property must be the fully qualified class name of
640 a concrete subclass of ConfigFileList which has a default
641 public constructor and defines the Hibernate mapping files that
644 schemaexport: Generate SQL code to create the required database structures.
646 startdb: Startup a lightweight database. The database
647 type to start is obtained from the currently
650 schemaupdate: Populate the database with a schema by running
651 Hibernate schemaupdate against the currently