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"/>
15 <property environment="env"/>
17 <target name="download.dep">
19 <isset property="proxyhost"/>
21 <setproxy proxyhost="${proxyhost}" proxyport="${proxyport}"/>
25 <isset property="artifact"/>
27 <echo>Getting dependence ${group}/${artifact}/${version}</echo>
28 <dependencies verbose="true" fileSetId="my.deps">
29 <dependency group="${group}" artifact="${artifact}" version="${version}"/>
31 <copy todir="${download.dir}" flatten="yes">
32 <fileset refid="my.deps"/>
36 <echo>Getting dependence ${group}/${version}</echo>
37 <dependencies verbose="true" fileSetId="my.deps">
38 <dependency group="${group}" version="${version}"/>
40 <copy todir="${download.dir}" flatten="yes">
41 <fileset refid="my.deps"/>
48 <target name="log4j.d">
49 <antcall target="download.dep">
50 <param name="group" value="log4j"/>
51 <param name="version" value="1.2.9"/>
55 <target name="commons-beanutils.d">
56 <antcall target="download.dep">
57 <param name="group" value="commons-beanutils"/>
58 <param name="version" value="1.7.0"/>
62 <target name="commons-collections.d">
63 <antcall target="download.dep">
64 <param name="group" value="commons-collections"/>
65 <param name="version" value="3.1"/>
70 <target name="commons-logging.d">
71 <antcall target="download.dep">
72 <param name="group" value="commons-logging"/>
73 <param name="artifact" value="commons-logging"/>
74 <param name="version" value="1.0.2"/>
78 <target name="commons-codec.d">
79 <antcall target="download.dep">
80 <param name="group" value="commons-codec"/>
81 <param name="version" value="1.3"/>
85 <target name="commons-email.d">
86 <antcall target="download.dep">
87 <param name="group" value="commons-email"/>
88 <param name="version" value="1.0"/>
92 <target name="servletapi.d">
93 <antcall target="download.dep">
94 <param name="group" value="servletapi"/>
95 <param name="version" value="2.4"/>
99 <target name="quartz.d">
100 <antcall target="download.dep">
101 <param name="group" value="quartz"/>
102 <param name="version" value="1.5.1"/>
108 <target name="logging.d" depends="log4j.d,commons-logging.d">
111 <target name="dom4j.d">
112 <antcall target="download.dep">
113 <param name="group" value="dom4j"/>
114 <param name="version" value="1.6"/>
116 <antcall target="download.dep">
117 <param name="group" value="jaxen"/>
118 <param name="version" value="1.1-beta-4"/>
122 <target name="ehcache.d">
123 <antcall target="download.dep">
124 <param name="group" value="ehcache"/>
125 <param name="version" value="1.1"/>
129 <target name="xerces.d">
130 <antcall target="download.dep">
131 <param name="group" value="xerces"/>
132 <param name="version" value="2.4.0"/>
136 <target name="oro.d">
137 <antcall target="download.dep">
138 <param name="group" value="oro"/>
139 <param name="version" value="2.0.6"/>
143 <target name="cglib.d">
144 <antcall target="download.dep">
145 <param name="group" value="cglib"/>
146 <param name="version" value="2.1"/>
150 <target name="hibernate.d" depends="cglib.d,oro.d">
151 <antcall target="download.dep">
152 <param name="group" value="hibernate"/>
153 <param name="version" value="3.0.5"/>
157 <target name="hibernate.standalone.d" depends="hibernate.d">
158 <copy todir="${download.dir}">
159 <fileset dir="${special.lib.dir}/hibernate">
160 <include name="*.jar"/>
165 <target name="spring.d">
166 <antcall target="download.dep">
167 <param name="group" value="springframework"/>
168 <param name="artifact" value="spring"/>
169 <param name="version" value="1.2.5"/>
173 <target name="activation.d">
174 <copy todir="${download.dir}">
175 <fileset dir="${special.lib.dir}/jaf-1.0.2">
176 <include name="*.jar"/>
181 <target name="mail.d" depends="activation.d">
182 <copy todir="${download.dir}">
183 <fileset dir="${special.lib.dir}/javamail-1.3.3_01">
184 <include name="*.jar"/>
191 <target name="httpclient.d">
192 <antcall target="download.dep">
193 <param name="group" value="commons-httpclient"/>
194 <param name="version" value="3.0"/>
198 <target name="jtidy.d">
199 <antcall target="download.dep">
200 <param name="group" value="jtidy"/>
201 <param name="version" value="4aug2000r7-dev"/>
205 <property name="support.dist.dir" value="${lib.dir}/wamblee/support"/>
206 <target name="wamblee.support.d">
207 <copy todir="${download.dir}">
208 <fileset dir="${support.dist.dir}">
209 <include name="wamblee-support.jar"/>
213 <target name="wamblee.support.test.d">
214 <copy todir="${download.dir}">
215 <fileset dir="${support.dist.dir}">
216 <include name="wamblee-support-test.jar"/>
222 <target name="junit.d">
223 <antcall target="download.dep">
224 <param name="group" value="junit"/>
225 <param name="version" value="3.8.1"/>
227 <copy todir="${download.dir}">
228 <fileset dir="${special.lib.dir}/test">
229 <include name="*.jar"/>
234 <target name="emma.d">
235 <antcall target="download.dep">
236 <param name="group" value="emma"/>
237 <param name="artifact" value="emma"/>
238 <param name="version" value="2.0.5312"/>
240 <antcall target="download.dep">
241 <param name="group" value="emma"/>
242 <param name="artifact" value="emma_ant"/>
243 <param name="version" value="2.0.5312"/>
247 <target name="jmock.d">
248 <antcall target="download.dep">
249 <param name="group" value="jmock"/>
250 <param name="artifact" value="jmock"/>
251 <param name="version" value="1.0.1"/>
253 <antcall target="download.dep">
254 <param name="group" value="jmock"/>
255 <param name="artifact" value="jmock-cglib"/>
256 <param name="version" value="1.0.1"/>
260 <target name="dbunit.d">
261 <antcall target="download.dep">
262 <param name="group" value="dbunit"/>
263 <param name="version" value="2.1"/>
268 <target name="antlr.d">
269 <antcall target="download.dep">
270 <param name="group" value="antlr"/>
271 <param name="version" value="2.7.2"/>
275 <target name="checkstyle.d" depends="antlr.d,commons-beanutils.d,commons-logging.d,commons-collections.d">
276 <antcall target="download.dep">
277 <param name="group" value="checkstyle"/>
278 <param name="version" value="4.1"/>
282 <!-- common test dependencies for all test code -->
283 <target name="test.d" depends="junit.d,jmock.d,dbunit.d,emma.d">
286 <!-- downloaded dependencies for ant tasks -->
287 <target name="ant.d" depends="checkstyle.d">
292 <target name="import_header" unless="build_header_included">
294 <property name="ant.lib.dir" value="${build.dir}/lib/ant"/>
295 <property name="test.lib.dir" value="lib/test"/>
296 <property name="special.lib.dir" value="${build.dir}/lib/special"/>
297 <property name="ant.downloaded.lib.dir" value="${build.dir}/lib/ant/downloaded"/>
300 <!-- ========================================================================================
302 ======================================================================================== -->
304 <!-- ant-contrib integration -->
305 <property name="ant.contrib.home" value="${ant.lib.dir}/ant-contrib-1.0b2"/>
306 <taskdef resource="net/sf/antcontrib/antlib.xml">
308 <pathelement location="${ant.contrib.home}/ant-contrib.jar" />
312 <!-- taskdef for ant-dependencies task -->
313 <taskdef name="dependencies" classpath="${ant.lib.dir}/ant-dependencies.jar"
314 classname="org.apache.tools.ant.taskdefs.optional.dependencies.Dependencies"/>
316 <!-- Emma integration -->
318 <available file="${test.lib.dir}"/>
321 <fileset dir="${test.lib.dir}" includes="emma*.jar"/>
323 <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
324 <property name="emma.enabled" value="false"/>
329 <property name="checkstyle.home" value="${ant.downloaded.lib.dir}"/>
330 <taskdef resource="checkstyletask.properties">
332 <fileset dir="${checkstyle.home}">
333 <include name="*.jar"/>
337 <property name="checkstyle.rules" value="style.xml"/>
338 <property name="checkstyle.test.rules" value="test-style.xml"/>
342 <!-- TMP download this dependence as well
343 <property name="jalopy.home" value="${lib.dir}/jalopy-ant-0.6.2"/>
344 <property name="jalopy.rules" value="${build.dir}/formatting-rules.xml"/>
345 <taskdef name="jalopy"
346 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
348 <fileset dir="${jalopy.home}">
349 <include name="*.jar" />
355 <!-- simian integration -->
356 <!-- TMP download this dependence as well
357 <property name="simian.home" value="${lib.dir}/simian"/>
358 <taskdef resource="simiantask.properties" classpath="${simian.home}/simian.jar"/>
361 <!-- macker integration -->
362 <!-- TMP download this dependence as well
363 <property name="macker.home" value="${lib.dir}/macker-0.4.2"/>
364 <path id="macker.path">
365 <fileset dir="${macker.home}">
366 <include name="**/*.jar"/>
369 <taskdef name="macker"
370 classname="net.innig.macker.ant.MackerAntTask"
371 classpathref="macker.path"/>
375 <!-- ========================================================================================
376 Locate user properties to (optionally) override defaults
377 ======================================================================================== -->
380 Give user a chance to override without editing this file
381 (and without typing -D each time they run it).
383 The following properties must be defined in this file:
384 - jcoverage.home: root of the jcoverage installation.
385 - jalopy.home: root of the jalopy installation.
387 <property name="user.property.file" value="${user.home}/wamblee.properties"/>
388 <available file="${user.property.file}" property="user.properties.found"/>
389 <property file="${user.property.file}"/>
391 <antcall target="echoUserPropertiesFileFound"/>
392 <antcall target="echoUserPropertiesFileNotFound"/>
394 <!-- project properties defaults, can be overriden in the user's properties file -->
396 <!-- The project.home property can also be overriden in a build.xml
397 in case the source is in a subdirectory and not necessarily
398 in the top-level directory -->
402 <isset property="webroot.dir"/>
404 <property name="external.lib.dir" value="${webroot.dir}/WEB-INF/lib"/>
407 <property name="external.lib.dir" value="lib/external"/>
411 <property name="build.properties.dir" value="${project.home}" />
412 <property name="build.properties.name" value="build.properties" />
414 <mkdir dir="${external.lib.dir}"/>
415 <mkdir dir="${test.lib.dir}"/>
417 <property name="conf.dir" value="conf"/>
418 <property name="log4j.properties.dir" value="${conf.dir}/properties"/>
420 <!-- Compilation properties -->
421 <property name="javac.debug" value="true"/>
422 <property name="javac.debug.level" value="lines,vars,source"/>
423 <property name="javac.source" value="1.5"/>
425 <!-- ========================================================================================
426 Standard path definitions to be used with all projects
427 ======================================================================================= -->
428 <property name="xmlschemas.dir" value="${conf.dir}/schemas"/>
429 <path id="xmlschemas.path">
430 <pathelement location="${xmlschemas.dir}"/>
433 <!-- ========================================================================================
434 Path definitions for external libraries.
435 ======================================================================================== -->
437 <!-- Ignore system classpath! -->
438 <property name="build.sysclasspath" value="ignore" />
441 <property name="junit.halt.on.failure" value="false"/>
442 <property name="unitreport" value="cl-unit.xml"/>
444 <!-- DocCheck path -->
445 <property name="doccheck.home" value="${ant.lib.dir}/doccheck1.2b2/doccheck.jar"/>
446 <path id="doccheck.path">
447 <pathelement location="${doccheck.home}"/>
450 <!-- PdfDoclet path -->
451 <property name="pdfdoclet.home" value="${ant.lib.dir}/pdfdoclet-1.0.2-all.jar"/>
452 <path id="pdfdoclet.path">
453 <pathelement location="${pdfdoclet.home}"/>
456 <!-- Hibernate paths -->
457 <!-- name of the file in the source directory containing
458 the names of hibernate files to look at in the correct order -->
459 <property name="hibernate.home" value="${lib.dir}/hibernate-3.0"/>
460 <path id="hibernate.basic.path">
461 <fileset dir="${hibernate.home}">
462 <include name="*.jar"/>
464 <path refid="xerces.path"/>
465 <path refid="dom4j.path"/>
467 <path id="hibernate.appserver.path">
468 <path refid="hibernate.basic.path"/>
469 <fileset dir="${hibernate.home}/appserver">
470 <include name="*.jar"/>
473 <path id="hibernate.standalone.path">
474 <path refid="hibernate.basic.path"/>
475 <fileset dir="${hibernate.home}/standalone">
476 <include name="*.jar"/>
480 <!-- Commented the inclusion of a system-wide path in the user's environment into a
481 classpath. System wide classpaths should not be used. -->
482 <!-- property name="classpath_id" value="build.path" / -->
483 <!-- property name="classpath" refid="${classpath_id}"/ -->
484 <property name="classpath" value=""/>
487 <!-- ========================================================================================
489 ======================================================================================== -->
490 <property name="database" value="Derby"/>
494 <!-- ========================================================================================
496 ======================================================================================== -->
497 <echo level="debug" message="project.home=${project.home}"/>
498 <echo level="debug" message="project.libs=${project.libs}"/>
499 <echo level="debug" message="classpath=${classpath}"/>
502 <!-- ========================================================================================
504 ======================================================================================== -->
505 <property name="build_header_included" value="true" />
508 <!-- =================================================================
509 Sets up the directory definitions for the module
510 ================================================================= -->
511 <target name="init_directory_properties" depends="import_header">
512 <!-- Set module properties for this build -->
514 <property name="module.home" value="." />
516 <!-- Replace the dash by a / to create a relative directory
517 from a module name -->
518 <propertyregex property="module.reldir"
519 input="${module.name}"
523 defaultValue="${module.name}"/>
524 <!-- property name="module.build.dir"
525 value="${build.dir}/${module.reldir}" / -->
526 <property name="module.build.dir" value="build"/>
527 <property name="module.api.forrest.dir" value="${forrest.build.site.dir}/api/${module.name}" />
529 <isset property="webroot.dir"/>
531 <property name="module.classes.dir" value="${webroot.dir}/WEB-INF/classes" />
534 <property name="module.classes.dir" value="${module.build.dir}/bin" />
538 <property name="module.testclasses.dir" value="${module.build.dir}/testbin" />
539 <!-- Directory where generated SQL will be put by the schema export-->
540 <property name="module.sql.dir" value="${module.build.dir}/sql" />
543 <property name="module.jcovclasses.dir"
544 value="${module.build.dir}/testjcov" />
545 <property name="module.jars.dir" value="${module.build.dir}/jars" />
546 <property name="module.jar.file"
547 value="${module.jars.dir}/${module.jar.name}" />
548 <property name="module.source.dir" value="${module.home}/src" />
549 <property name="module.forrest.src.dir" value="${module.home}/xdocs" />
550 <property name="module.ejbsource.dir" value="${module.home}/ejbsrc" />
551 <property name="module.test.dir" value="${module.home}/test" />
552 <property name="module.testjar.name"
553 value="${module.name}-test.jar" />
554 <property name="module.testresourcesjar.name"
555 value="${module.name}-test-resources.jar" />
556 <property name="module.resource.dir"
557 value="${module.home}/resources" />
558 <property name="module.testresource.dir"
559 value="${module.resource.dir}/test" />
560 <property name="module.testoutput.dir"
561 value="${module.resource.dir}/testoutput"/>
562 <property name="module.report.dir"
563 value="${module.build.dir}/testresults" />
564 <property name="module.emmareport.dir"
565 value="${module.report.dir}/html/emma"/>
566 <property name="module.docbase.dir"
567 value="${module.build.dir}/docs" />
568 <property name="module.javadoc.dir"
569 value="${module.docbase.dir}/api" />
570 <property name="module.javadocjar.name"
571 value="${module.name}-doc.jar" />
572 <property name="module.testjavadocjar.name"
573 value="${module.name}-test-doc.jar" />
574 <property name="module.testjavadoc.dir"
575 value="${module.docbase.dir}/testapi" />
576 <property name="module.pdfdoc.dir"
577 value="${module.docbase.dir}/pdf" />
578 <property name="module.doccheck.dir"
579 value="${module.docbase.dir}/doccheck" />
580 <property name="module.checkstyle.dir"
581 value="${module.docbase.dir}/checkstyle" />
582 <property name="module.jar.name" value="${module.name}.jar" />
584 <!-- Replace the dash by a / to create a relative directory
585 from a module name -->
586 <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
589 <!-- ============================================================================
590 Initialize the environment for other tasks. Normally, every task which
591 does not depend on any other task should at least depend on init.
592 ============================================================================ -->
594 <target name="help" depends="import_header">
595 <antcall target="help-within-module"/>
596 <antcall target="help-outside-module"/>
599 <target name="help-within-module" depends="init_directory_properties" if="module.name">
600 <antcall target="help-impl"/>
603 <target name="help-outside-module" unless="module.name">
604 <antcall target="help-outside-module-2">
605 <param name="module.name" value="MODULE_NAME"/>
609 <target name="help-outside-module-2" depends="init_directory_properties">
610 <antcall target="help-impl"/>
614 <target name="help-impl">
619 To execute with a specific proxy host and port, start ant with the
620 command-line options -Dproxyhost=hostname -Dproxyport=portnumber.
622 deps: Download dependencies, this is necessary for using
623 any of the build targets.
624 clean-deps: Remove downloaded dependencies.
626 General build targets:
628 clean: Cleans up all build results (excluding the dist location).
629 compile: Compiles all java clasess. Target dir ${module.classes.dir}
630 jar: Creates a jar file. Target: ${module.jar.file}
631 dist: Makes the build results available for other modules Target: ${module.dist.dir}.
632 dist-lite: Similar to dist but only creates the jars for code and test code. Useful
633 during development because it takes much less time than the dist
635 clean-dist: Cleans up the dist directories.
639 test: Compile and run tests.
640 junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit)
641 reports: As junit-reports but also generates an emma test coverage
644 Note: By specifying -Dtest=TestCaseName on the ant command line,
645 only the specified testcase will be run.
647 Emma can also be executed manually:
649 emma: Overwrites the production classes by their instrumented versions.
650 emma-reports: Generates emma code coverage reports after running the
651 testcases with instrumented classes.
655 javadoc: Generates javadoc. Target: ${module.javadoc.dir}
656 doccheck: Checks documentation. Target: ${module.doccheck.dir}
660 forrest: Generates project docs using forrest.
664 checkstyle: Checks the style of the code.
665 format: Formats to the code in accordance with the checkstyle rules.
666 simian: Analyse similarities in the code.
668 Building a web application:
670 To build a web application archive (WAR) you must set the property
671 webroot.dir to the value of the directory which is the root of your
672 web application. This must be done before the header.xl is
673 sourced. The build support will then make sure that
674 classes and libs are put in the correct directories below
675 ${webroot.dir}/WEB-INF, and it will build a web archive.
677 Database targets: ** database targets are not functional yet **
679 For all targets below the database is configured using
680 hibernate.properties (hibernate.dialect property) and
681 the JDBC connection properties in database.properties.
683 The schemaexport and schemaupdate targets require the
684 setting of a property named hibernate.filelist. The value
685 of the property must be the fully qualified class name of
686 a concrete subclass of ConfigFileList which has a default
687 public constructor and defines the Hibernate mapping files that
690 schemaexport: Generate SQL code to create the required database structures.
692 startdb: Startup a lightweight database. The database
693 type to start is obtained from the currently
696 schemaupdate: Populate the database with a schema by running
697 Hibernate schemaupdate against the currently