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="ehcache.d">
100 <antcall target="download.dep">
101 <param name="group" value="ehcache"/>
102 <param name="version" value="1.1"/>
106 <target name="xerces.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/basic"/>
199 <target name="wamblee.crawler.d">
200 <copy todir="${download.dir}">
201 <fileset dir="${crawler.dist.dir}">
202 <include name="crawler-basic.jar"/>
206 <target name="wamblee.crawler.test.d">
207 <copy todir="${download.dir}">
208 <fileset dir="${crawler.dist.dir}">
209 <include name="crawler-basic-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}/docs" />
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.checkstyle.dir"
550 value="${module.docbase.dir}/checkstyle" />
551 <property name="module.jar.name" value="${module.name}.jar" />
553 <!-- Replace the dash by a / to create a relative directory
554 from a module name -->
555 <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
558 <!-- ============================================================================
559 Initialize the environment for other tasks. Normally, every task which
560 does not depend on any other task should at least depend on init.
561 ============================================================================ -->
563 <target name="help" depends="import_header">
564 <antcall target="help-within-module"/>
565 <antcall target="help-outside-module"/>
568 <target name="help-within-module" depends="init_directory_properties" if="module.name">
569 <antcall target="help-impl"/>
572 <target name="help-outside-module" unless="module.name">
573 <antcall target="help-outside-module-2">
574 <param name="module.name" value="MODULE_NAME"/>
578 <target name="help-outside-module-2" depends="init_directory_properties">
579 <antcall target="help-impl"/>
583 <target name="help-impl">
588 To execute with a specific proxy host and port, start ant with the
589 command-line options -Dproxyhost=hostname -Dproxyport=portnumber.
591 deps: Download dependencies, this is necessary for using
592 any of the build targets.
593 clean-deps: Remove downloaded dependencies.
595 General build targets:
597 clean: Cleans up all build results (excluding the dist location).
598 compile: Compiles all java clasess. Target dir ${module.classes.dir}
599 jar: Creates a jar file. Target: ${module.jar.file}
600 dist: Makes the build results available for other modules Target: ${module.dist.dir}.
601 dist-lite: Similar to dist but only creates the jars for code and test code. Useful
602 during development because it takes much less time than the dist
604 clean-dist: Cleans up the dist directories.
608 test: Compile and run tests.
609 junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit)
610 reports: As junit-reports but also generates an emma test coverage
613 Note: By specifying -Dtest=TestCaseName on the ant command line,
614 only the specified testcase will be run.
616 Emma can also be executed manually:
618 emma: Overwrites the production classes by their instrumented versions.
619 emma-reports: Generates emma code coverage reports after running the
620 testcases with instrumented classes.
624 javadoc: Generates javadoc. Target: ${module.javadoc.dir}
625 doccheck: Checks documentation. Target: ${module.doccheck.dir}
629 checkstyle: Checks the style of the code.
630 format: Formats to the code in accordance with the checkstyle rules.
631 simian: Analyse similarities in the code.
635 For all targets below the database is configured using
636 hibernate.properties (hibernate.dialect property) and
637 the JDBC connection properties in database.properties.
639 The schemaexport and schemaupdate targets require the
640 setting of a property named hibernate.filelist. The value
641 of the property must be the fully qualified class name of
642 a concrete subclass of ConfigFileList which has a default
643 public constructor and defines the Hibernate mapping files that
646 schemaexport: Generate SQL code to create the required database structures.
648 startdb: Startup a lightweight database. The database
649 type to start is obtained from the currently
652 schemaupdate: Populate the database with a schema by running
653 Hibernate schemaupdate against the currently