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="artifact"/>
20 <echo>Getting dependence ${group}/${artifact}/${version}</echo>
21 <dependencies verbose="true" fileSetId="my.deps">
22 <dependency group="${group}" artifact="${artifact}" version="${version}"/>
24 <copy todir="${download.dir}" flatten="yes">
25 <fileset refid="my.deps"/>
29 <echo>Getting dependence ${group}/${version}</echo>
30 <dependencies verbose="true" fileSetId="my.deps">
31 <dependency group="${group}" version="${version}"/>
33 <copy todir="${download.dir}" flatten="yes">
34 <fileset refid="my.deps"/>
41 <target name="log4j.d">
42 <antcall target="download.dep">
43 <param name="group" value="log4j"/>
44 <param name="version" value="1.2.9"/>
48 <target name="commons-beanutils.d">
49 <antcall target="download.dep">
50 <param name="group" value="commons-beanutils"/>
51 <param name="version" value="1.7.0"/>
55 <target name="commons-collections.d">
56 <antcall target="download.dep">
57 <param name="group" value="commons-collections"/>
58 <param name="version" value="3.1"/>
63 <target name="commons-logging.d">
64 <antcall target="download.dep">
65 <param name="group" value="commons-logging"/>
66 <param name="artifact" value="commons-logging"/>
67 <param name="version" value="1.0.2"/>
71 <target name="commons-codec.d">
72 <antcall target="download.dep">
73 <param name="group" value="commons-codec"/>
74 <param name="version" value="1.3"/>
79 <target name="logging.d" depends="log4j.d,commons-logging.d">
82 <target name="dom4j.d">
83 <antcall target="download.dep">
84 <param name="group" value="dom4j"/>
85 <param name="version" value="1.6"/>
87 <antcall target="download.dep">
88 <param name="group" value="jaxen"/>
89 <param name="version" value="1.1-beta-4"/>
93 <target name="xerces.d">
94 <antcall target="download.dep">
95 <param name="group" value="ehcache"/>
96 <param name="version" value="1.1"/>
100 <target name="ehcache.d">
101 <antcall target="download.dep">
102 <param name="group" value="xerces"/>
103 <param name="version" value="2.4.0"/>
107 <target name="oro.d">
108 <antcall target="download.dep">
109 <param name="group" value="oro"/>
110 <param name="version" value="2.0.6"/>
114 <target name="cglib.d">
115 <antcall target="download.dep">
116 <param name="group" value="cglib"/>
117 <param name="version" value="2.1"/>
121 <target name="hibernate.d" depends="cglib.d,oro.d">
122 <antcall target="download.dep">
123 <param name="group" value="hibernate"/>
124 <param name="version" value="3.0.5"/>
128 <target name="hibernate.standalone.d" depends="hibernate.d">
129 <copy todir="${download.dir}">
130 <fileset dir="${special.lib.dir}/hibernate">
131 <include name="*.jar"/>
136 <target name="spring.d">
137 <antcall target="download.dep">
138 <param name="group" value="springframework"/>
139 <param name="artifact" value="spring"/>
140 <param name="version" value="1.2.5"/>
144 <target name="httpclient.d">
145 <antcall target="download.dep">
146 <param name="group" value="commons-httpclient"/>
147 <param name="version" value="3.0"/>
151 <target name="jtidy.d">
152 <antcall target="download.dep">
153 <param name="group" value="jtidy"/>
154 <param name="version" value="4aug2000r7-dev"/>
158 <property name="support.dist.dir" value="${lib.dir}/support"/>
159 <target name="wamblee.support.d">
160 <copy todir="${download.dir}">
161 <fileset dir="${support.dist.dir}">
162 <include name="support.jar"/>
166 <target name="wamblee.support.test.d">
167 <copy todir="${download.dir}">
168 <fileset dir="${support.dist.dir}">
169 <include name="support-test.jar"/>
174 <property name="crawler.dist.dir" value="${lib.dir}/crawler"/>
175 <target name="wamblee.crawler.d">
176 <copy todir="${download.dir}">
177 <fileset dir="${crawler.dist.dir}">
178 <include name="crawler.jar"/>
182 <target name="wamblee.crawler.test.d">
183 <copy todir="${download.dir}">
184 <fileset dir="${crawler.dist.dir}">
185 <include name="crawler-test.jar"/>
190 <target name="junit.d">
191 <antcall target="download.dep">
192 <param name="group" value="junit"/>
193 <param name="version" value="3.8.1"/>
195 <copy todir="${download.dir}">
196 <fileset dir="${special.lib.dir}/test">
197 <include name="*.jar"/>
202 <target name="emma.d">
203 <antcall target="download.dep">
204 <param name="group" value="emma"/>
205 <param name="artifact" value="emma"/>
206 <param name="version" value="2.0.5312"/>
208 <antcall target="download.dep">
209 <param name="group" value="emma"/>
210 <param name="artifact" value="emma_ant"/>
211 <param name="version" value="2.0.5312"/>
215 <target name="jmock.d">
216 <antcall target="download.dep">
217 <param name="group" value="jmock"/>
218 <param name="artifact" value="jmock"/>
219 <param name="version" value="1.0.1"/>
221 <antcall target="download.dep">
222 <param name="group" value="jmock"/>
223 <param name="artifact" value="jmock-cglib"/>
224 <param name="version" value="1.0.1"/>
228 <target name="dbunit.d">
229 <antcall target="download.dep">
230 <param name="group" value="dbunit"/>
231 <param name="version" value="2.1"/>
236 <target name="antlr.d">
237 <antcall target="download.dep">
238 <param name="group" value="antlr"/>
239 <param name="version" value="2.7.2"/>
243 <target name="checkstyle.d" depends="antlr.d,commons-beanutils.d,commons-logging.d,commons-collections.d">
244 <antcall target="download.dep">
245 <param name="group" value="checkstyle"/>
246 <param name="version" value="4.1"/>
250 <!-- common test dependencies for all test code -->
251 <target name="test.d" depends="junit.d,jmock.d,dbunit.d,emma.d">
254 <!-- downloaded dependencies for ant tasks -->
255 <target name="ant.d" depends="checkstyle.d">
260 <target name="import_header" unless="build_header_included">
262 <!-- ========================================================================================
263 Locate user properties to (optionally) override defaults
264 ======================================================================================== -->
267 Give user a chance to override without editing this file
268 (and without typing -D each time they run it).
270 The following properties must be defined in this file:
271 - jcoverage.home: root of the jcoverage installation.
272 - jalopy.home: root of the jalopy installation.
274 <property name="user.property.file" value="${user.home}/wamblee.properties"/>
275 <available file="${user.property.file}" property="user.properties.found"/>
276 <property file="${user.property.file}"/>
278 <antcall target="echoUserPropertiesFileFound"/>
279 <antcall target="echoUserPropertiesFileNotFound"/>
281 <!-- project properties defaults, can be overriden in the user's properties file -->
283 <!-- The project.home property can also be overriden in a build.xml
284 in case the source is in a subdirectory and not necessarily
285 in the top-level directory -->
287 <property name="ant.lib.dir" value="${project.home}/lib/ant"/>
288 <property name="ant.downloaded.lib.dir" value="${project.home}/lib/ant/downloaded"/>
289 <property name="external.lib.dir" value="lib/external"/>
290 <property name="test.lib.dir" value="lib/test"/>
291 <property name="special.lib.dir" value="${project.home}/lib/special"/>
292 <property name="forrest.xdocs.dir" value="${project.home}/site/xdocs"/>
293 <property name="forrest.build.dir" value="${project.home}/site/build"/>
294 <property name="forrest.build.site.dir" value="${forrest.build.dir}/site"/>
295 <property name="build.properties.dir" value="${project.home}" />
296 <property name="build.properties.name" value="build.properties" />
298 <mkdir dir="${external.lib.dir}"/>
299 <mkdir dir="${test.lib.dir}"/>
301 <property name="conf.dir" value="conf"/>
302 <property name="log4j.properties.dir" value="${conf.dir}/properties"/>
304 <!-- Compilation properties -->
305 <property name="javac.debug" value="true"/>
306 <property name="javac.debug.level" value="lines,vars,source"/>
307 <property name="javac.source" value="1.5"/>
309 <!-- ========================================================================================
310 Standard path definitions to be used with all projects
311 ======================================================================================= -->
312 <property name="xmlschemas.dir" value="${conf.dir}/schemas"/>
313 <path id="xmlschemas.path">
314 <pathelement location="${xmlschemas.dir}"/>
317 <!-- ========================================================================================
318 Path definitions for external libraries.
319 ======================================================================================== -->
321 <!-- Ignore system classpath! -->
322 <property name="build.sysclasspath" value="ignore" />
325 <property name="junit.halt.on.failure" value="false"/>
326 <property name="unitreport" value="cl-unit.xml"/>
328 <!-- DocCheck path -->
329 <property name="doccheck.home" value="${ant.lib.dir}/doccheck1.2b2/doccheck.jar"/>
330 <path id="doccheck.path">
331 <pathelement location="${doccheck.home}"/>
334 <!-- PdfDoclet path -->
335 <property name="pdfdoclet.home" value="${ant.lib.dir}/pdfdoclet-1.0.2-all.jar"/>
336 <path id="pdfdoclet.path">
337 <pathelement location="${pdfdoclet.home}"/>
340 <!-- Hibernate paths -->
341 <!-- name of the file in the source directory containing
342 the names of hibernate files to look at in the correct order -->
343 <property name="hibernate.home" value="${lib.dir}/hibernate-3.0"/>
344 <path id="hibernate.basic.path">
345 <fileset dir="${hibernate.home}">
346 <include name="*.jar"/>
348 <path refid="xerces.path"/>
349 <path refid="dom4j.path"/>
351 <path id="hibernate.appserver.path">
352 <path refid="hibernate.basic.path"/>
353 <fileset dir="${hibernate.home}/appserver">
354 <include name="*.jar"/>
357 <path id="hibernate.standalone.path">
358 <path refid="hibernate.basic.path"/>
359 <fileset dir="${hibernate.home}/standalone">
360 <include name="*.jar"/>
364 <!-- Commented the inclusion of a system-wide path in the user's environment into a
365 classpath. System wide classpaths should not be used. -->
366 <!-- property name="classpath_id" value="build.path" / -->
367 <!-- property name="classpath" refid="${classpath_id}"/ -->
368 <property name="classpath" value=""/>
371 <!-- ========================================================================================
373 ======================================================================================== -->
374 <property name="database" value="Derby"/>
376 <!-- ========================================================================================
378 ======================================================================================== -->
380 <!-- ant-contrib integration -->
381 <property name="ant.contrib.home" value="${ant.lib.dir}/ant-contrib-1.0b2"/>
382 <taskdef resource="net/sf/antcontrib/antlib.xml">
384 <pathelement location="${ant.contrib.home}/ant-contrib.jar" />
388 <!-- taskdef for ant-dependencies task -->
389 <taskdef name="dependencies" classpath="${ant.lib.dir}/ant-dependencies.jar"
390 classname="org.apache.tools.ant.taskdefs.optional.dependencies.Dependencies"/>
392 <!-- Emma integration -->
394 <fileset dir="${test.lib.dir}" includes="emma*.jar"/>
396 <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
397 <property name="emma.enabled" value="false"/>
400 <property name="checkstyle.home" value="${ant.downloaded.lib.dir}"/>
401 <taskdef resource="checkstyletask.properties">
403 <fileset dir="${checkstyle.home}">
404 <include name="*.jar"/>
408 <property name="checkstyle.rules" value="style.xml"/>
409 <property name="checkstyle.test.rules" value="test-style.xml"/>
413 <!-- TMP download this dependence as well
414 <property name="jalopy.home" value="${lib.dir}/jalopy-ant-0.6.2"/>
415 <property name="jalopy.rules" value="${build.dir}/formatting-rules.xml"/>
416 <taskdef name="jalopy"
417 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
419 <fileset dir="${jalopy.home}">
420 <include name="*.jar" />
426 <!-- simian integration -->
427 <!-- TMP download this dependence as well
428 <property name="simian.home" value="${lib.dir}/simian"/>
429 <taskdef resource="simiantask.properties" classpath="${simian.home}/simian.jar"/>
432 <!-- macker integration -->
433 <!-- TMP download this dependence as well
434 <property name="macker.home" value="${lib.dir}/macker-0.4.2"/>
435 <path id="macker.path">
436 <fileset dir="${macker.home}">
437 <include name="**/*.jar"/>
440 <taskdef name="macker"
441 classname="net.innig.macker.ant.MackerAntTask"
442 classpathref="macker.path"/>
446 <!-- ========================================================================================
448 ======================================================================================== -->
449 <echo level="debug" message="project.home=${project.home}"/>
450 <echo level="debug" message="project.libs=${project.libs}"/>
451 <echo level="debug" message="classpath=${classpath}"/>
454 <!-- ========================================================================================
456 ======================================================================================== -->
457 <property name="build_header_included" value="true" />
460 <!-- =================================================================
461 Sets up the directory definitions for the module
462 ================================================================= -->
463 <target name="init_directory_properties" depends="import_header">
464 <!-- Set module properties for this build -->
466 <property name="module.home" value="." />
468 <!-- Replace the dash by a / to create a relative directory
469 from a module name -->
470 <propertyregex property="module.reldir"
471 input="${module.name}"
475 defaultValue="${module.name}"/>
476 <property name="module.build.dir"
477 value="${build.dir}/${module.reldir}" />
479 <property name="module.api.forrest.dir" value="${forrest.build.site.dir}/api/${module.name}" />
480 <!-- property name="module.classes.dir" value="${module.build.dir}/bin"/ -->
481 <!-- property name="module.testclasses.dir" value="${module.build.dir}/testbin"/ -->
482 <property name="module.classes.dir" value="bin" />
483 <property name="module.testclasses.dir" value="testbin" />
484 <!-- Directory where generated SQL will be put by the schema export-->
485 <property name="module.sql.dir" value="${module.build.dir}/sql" />
488 <property name="module.jcovclasses.dir"
489 value="${module.build.dir}/testjcov" />
490 <property name="module.jars.dir" value="${module.build.dir}/jars" />
491 <property name="module.jar.file"
492 value="${module.jars.dir}/${module.jar.name}" />
493 <property name="module.source.dir" value="${module.home}/src" />
494 <property name="module.forrest.src.dir" value="${module.home}/xdocs" />
495 <property name="module.ejbsource.dir" value="${module.home}/ejbsrc" />
496 <property name="module.test.dir" value="${module.home}/test" />
497 <property name="module.testjar.name"
498 value="${module.name}-test.jar" />
499 <property name="module.testresourcesjar.name"
500 value="${module.name}-test-resources.jar" />
501 <property name="module.resource.dir"
502 value="${module.home}/resources" />
503 <property name="module.testresource.dir"
504 value="${module.resource.dir}/test" />
505 <property name="module.testoutput.dir"
506 value="${module.resource.dir}/testoutput"/>
507 <property name="module.report.dir"
508 value="${module.build.dir}/testresults" />
509 <property name="module.emmareport.dir"
510 value="${module.report.dir}/html/emma"/>
511 <property name="module.docbase.dir"
512 value="${module.build.dir}/javadoc" />
513 <property name="module.javadoc.dir"
514 value="${module.docbase.dir}/api" />
515 <property name="module.javadocjar.name"
516 value="${module.name}-doc.jar" />
517 <property name="module.testjavadocjar.name"
518 value="${module.name}-test-doc.jar" />
519 <property name="module.testjavadoc.dir"
520 value="${module.docbase.dir}/testapi" />
521 <property name="module.pdfdoc.dir"
522 value="${module.docbase.dir}/pdf" />
523 <property name="module.doccheck.dir"
524 value="${module.docbase.dir}/doccheck" />
525 <property name="module.jar.name" value="${module.name}.jar" />
527 <!-- Replace the dash by a / to create a relative directory
528 from a module name -->
529 <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
532 <!-- ============================================================================
533 Initialize the environment for other tasks. Normally, every task which
534 does not depend on any other task should at least depend on init.
535 ============================================================================ -->
537 <target name="help" depends="import_header">
538 <antcall target="help-within-module"/>
539 <antcall target="help-outside-module"/>
542 <target name="help-within-module" depends="init_directory_properties" if="module.name">
543 <antcall target="help-impl"/>
546 <target name="help-outside-module" unless="module.name">
547 <antcall target="help-outside-module-2">
548 <param name="module.name" value="MODULE_NAME"/>
552 <target name="help-outside-module-2" depends="init_directory_properties">
553 <antcall target="help-impl"/>
557 <target name="help-impl">
562 deps: Download dependencies, this is necessary for using
563 any of the build targets.
564 clean-deps: Remove downloaded dependencies.
566 General build targets:
568 clean: Cleans up all build results (excluding the dist location).
569 compile: Compiles all java clasess. Target dir ${module.classes.dir}
570 jar: Creates a jar file. Target: ${module.jar.file}
571 dist: Makes the build results available for other modules Target: ${module.dist.dir}.
572 dist-lite: Similar to dist but only creates the jars for code and test code. Useful
573 during development because it takes much less time than the dist
575 clean-dist: Cleans up the dist directories.
579 test: Compile and run tests.
580 junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit)
581 reports: As junit-reports but also generates an emma test coverage
584 Note: By specifying -Dtest=TestCaseName on the ant command line,
585 only the specified testcase will be run.
587 Emma can also be executed manually:
589 emma: Overwrites the production classes by their instrumented versions.
590 emma-reports: Generates emma code coverage reports after running the
591 testcases with instrumented classes.
595 javadoc: Generates javadoc. Target: ${module.javadoc.dir}
596 doccheck: Checks documentation. Target: ${module.doccheck.dir}
600 checkstyle: Checks the style of the code.
601 format: Formats to the code in accordance with the checkstyle rules.
602 simian: Analyse similarities in the code.
606 For all targets below the database is configured using
607 hibernate.properties (hibernate.dialect property) and
608 the JDBC connection properties in database.properties.
610 The schemaexport and schemaupdate targets require the
611 setting of a property named hibernate.filelist. The value
612 of the property must be the fully qualified class name of
613 a concrete subclass of ConfigFileList which has a default
614 public constructor and defines the Hibernate mapping files that
617 schemaexport: Generate SQL code to create the required database structures.
619 startdb: Startup a lightweight database. The database
620 type to start is obtained from the currently
623 schemaupdate: Populate the database with a schema by running
624 Hibernate schemaupdate against the currently