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="jstl.d">
100 <antcall target="download.dep">
101 <param name="group" value="jstl"/>
102 <param name="version" value="1.1.2"/>
104 <antcall target="download.dep">
105 <param name="group" value="taglibs"/>
106 <param name="artifact" value="standard"/>
107 <param name="version" value="1.1.2"/>
113 <target name="quartz.d">
114 <antcall target="download.dep">
115 <param name="group" value="quartz"/>
116 <param name="version" value="1.5.1"/>
122 <target name="logging.d" depends="log4j.d,commons-logging.d">
125 <target name="dom4j.d">
126 <antcall target="download.dep">
127 <param name="group" value="dom4j"/>
128 <param name="version" value="1.6"/>
130 <antcall target="download.dep">
131 <param name="group" value="jaxen"/>
132 <param name="version" value="1.1-beta-4"/>
136 <target name="jfreechart.d">
137 <copy todir="${download.dir}">
138 <fileset dir="${special.lib.dir}/jfreechart-1.0.1">
139 <include name="*.jar"/>
144 <target name="ehcache.d">
145 <antcall target="download.dep">
146 <param name="group" value="ehcache"/>
147 <param name="version" value="1.1"/>
151 <target name="xerces.d">
152 <antcall target="download.dep">
153 <param name="group" value="xerces"/>
154 <param name="version" value="2.4.0"/>
158 <target name="oro.d">
159 <antcall target="download.dep">
160 <param name="group" value="oro"/>
161 <param name="version" value="2.0.6"/>
165 <target name="cglib.d">
166 <antcall target="download.dep">
167 <param name="group" value="cglib"/>
168 <param name="version" value="2.1"/>
172 <target name="hibernate.d" depends="cglib.d,oro.d">
173 <antcall target="download.dep">
174 <param name="group" value="hibernate"/>
175 <param name="version" value="3.0.5"/>
179 <target name="hibernate.standalone.d" depends="hibernate.d">
180 <copy todir="${download.dir}">
181 <fileset dir="${special.lib.dir}/hibernate">
182 <include name="*.jar"/>
187 <target name="spring.d">
188 <antcall target="download.dep">
189 <param name="group" value="springframework"/>
190 <param name="artifact" value="spring"/>
191 <param name="version" value="1.2.5"/>
195 <target name="activation.d">
196 <copy todir="${download.dir}">
197 <fileset dir="${special.lib.dir}/jaf-1.0.2">
198 <include name="*.jar"/>
203 <target name="mail.d" depends="activation.d">
204 <copy todir="${download.dir}">
205 <fileset dir="${special.lib.dir}/javamail-1.3.3_01">
206 <include name="*.jar"/>
213 <target name="httpclient.d">
214 <antcall target="download.dep">
215 <param name="group" value="commons-httpclient"/>
216 <param name="version" value="3.0"/>
220 <target name="jtidy.d">
221 <antcall target="download.dep">
222 <param name="group" value="jtidy"/>
223 <param name="version" value="4aug2000r7-dev"/>
227 <property name="support.dist.dir" value="${lib.dir}/wamblee/support"/>
228 <target name="wamblee.support.d">
229 <copy todir="${download.dir}">
230 <fileset dir="${support.dist.dir}">
231 <include name="wamblee-support.jar"/>
235 <target name="wamblee.support.test.d">
236 <copy todir="${download.dir}">
237 <fileset dir="${support.dist.dir}">
238 <include name="wamblee-support-test.jar"/>
244 <target name="junit.d">
245 <antcall target="download.dep">
246 <param name="group" value="junit"/>
247 <param name="version" value="3.8.1"/>
249 <copy todir="${download.dir}">
250 <fileset dir="${special.lib.dir}/test">
251 <include name="*.jar"/>
256 <target name="emma.d">
257 <antcall target="download.dep">
258 <param name="group" value="emma"/>
259 <param name="artifact" value="emma"/>
260 <param name="version" value="2.0.5312"/>
262 <antcall target="download.dep">
263 <param name="group" value="emma"/>
264 <param name="artifact" value="emma_ant"/>
265 <param name="version" value="2.0.5312"/>
269 <target name="jmock.d">
270 <antcall target="download.dep">
271 <param name="group" value="jmock"/>
272 <param name="artifact" value="jmock"/>
273 <param name="version" value="1.0.1"/>
275 <antcall target="download.dep">
276 <param name="group" value="jmock"/>
277 <param name="artifact" value="jmock-cglib"/>
278 <param name="version" value="1.0.1"/>
282 <target name="dbunit.d">
283 <antcall target="download.dep">
284 <param name="group" value="dbunit"/>
285 <param name="version" value="2.1"/>
290 <target name="antlr.d">
291 <antcall target="download.dep">
292 <param name="group" value="antlr"/>
293 <param name="version" value="2.7.2"/>
297 <target name="checkstyle.d" depends="antlr.d,commons-beanutils.d,commons-logging.d,commons-collections.d">
298 <antcall target="download.dep">
299 <param name="group" value="checkstyle"/>
300 <param name="version" value="4.1"/>
304 <!-- common test dependencies for all test code -->
305 <target name="test.d" depends="junit.d,jmock.d,dbunit.d,emma.d">
308 <!-- downloaded dependencies for ant tasks -->
309 <target name="ant.d" depends="checkstyle.d">
314 <target name="import_header" unless="build_header_included">
316 <property name="ant.lib.dir" value="${build.dir}/lib/ant"/>
317 <property name="test.lib.dir" value="lib/test"/>
318 <property name="special.lib.dir" value="${build.dir}/lib/special"/>
319 <property name="ant.downloaded.lib.dir" value="${build.dir}/lib/ant/downloaded"/>
322 <!-- ========================================================================================
324 ======================================================================================== -->
326 <!-- ant-contrib integration -->
327 <property name="ant.contrib.home" value="${ant.lib.dir}/ant-contrib-1.0b2"/>
328 <taskdef resource="net/sf/antcontrib/antlib.xml">
330 <pathelement location="${ant.contrib.home}/ant-contrib.jar" />
334 <!-- taskdef for ant-dependencies task -->
335 <taskdef name="dependencies" classpath="${ant.lib.dir}/ant-dependencies.jar"
336 classname="org.apache.tools.ant.taskdefs.optional.dependencies.Dependencies"/>
338 <!-- Emma integration -->
340 <available file="${test.lib.dir}"/>
343 <fileset dir="${test.lib.dir}" includes="emma*.jar"/>
345 <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
346 <property name="emma.enabled" value="false"/>
351 <property name="checkstyle.home" value="${ant.downloaded.lib.dir}"/>
352 <taskdef resource="checkstyletask.properties">
354 <fileset dir="${checkstyle.home}">
355 <include name="*.jar"/>
359 <property name="checkstyle.rules" value="style.xml"/>
360 <property name="checkstyle.test.rules" value="test-style.xml"/>
364 <!-- TMP download this dependence as well
365 <property name="jalopy.home" value="${lib.dir}/jalopy-ant-0.6.2"/>
366 <property name="jalopy.rules" value="${build.dir}/formatting-rules.xml"/>
367 <taskdef name="jalopy"
368 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
370 <fileset dir="${jalopy.home}">
371 <include name="*.jar" />
377 <!-- simian integration -->
378 <!-- TMP download this dependence as well
379 <property name="simian.home" value="${lib.dir}/simian"/>
380 <taskdef resource="simiantask.properties" classpath="${simian.home}/simian.jar"/>
383 <!-- macker integration -->
384 <!-- TMP download this dependence as well
385 <property name="macker.home" value="${lib.dir}/macker-0.4.2"/>
386 <path id="macker.path">
387 <fileset dir="${macker.home}">
388 <include name="**/*.jar"/>
391 <taskdef name="macker"
392 classname="net.innig.macker.ant.MackerAntTask"
393 classpathref="macker.path"/>
397 <!-- ========================================================================================
398 Locate user properties to (optionally) override defaults
399 ======================================================================================== -->
402 Give user a chance to override without editing this file
403 (and without typing -D each time they run it).
405 The following properties must be defined in this file:
406 - jcoverage.home: root of the jcoverage installation.
407 - jalopy.home: root of the jalopy installation.
409 <property name="user.property.file" value="${user.home}/wamblee.properties"/>
410 <available file="${user.property.file}" property="user.properties.found"/>
411 <property file="${user.property.file}"/>
413 <antcall target="echoUserPropertiesFileFound"/>
414 <antcall target="echoUserPropertiesFileNotFound"/>
416 <!-- project properties defaults, can be overriden in the user's properties file -->
418 <!-- The project.home property can also be overriden in a build.xml
419 in case the source is in a subdirectory and not necessarily
420 in the top-level directory -->
424 <isset property="webroot.dir"/>
426 <property name="external.lib.dir" value="${webroot.dir}/WEB-INF/lib"/>
429 <property name="external.lib.dir" value="lib/external"/>
433 <property name="build.properties.dir" value="${project.home}" />
434 <property name="build.properties.name" value="build.properties" />
436 <mkdir dir="${external.lib.dir}"/>
437 <mkdir dir="${test.lib.dir}"/>
439 <property name="conf.dir" value="conf"/>
440 <property name="log4j.properties.dir" value="${conf.dir}/properties"/>
442 <!-- Compilation properties -->
443 <property name="javac.debug" value="true"/>
444 <property name="javac.debug.level" value="lines,vars,source"/>
445 <property name="javac.source" value="1.5"/>
447 <!-- ========================================================================================
448 Standard path definitions to be used with all projects
449 ======================================================================================= -->
450 <property name="xmlschemas.dir" value="${conf.dir}/schemas"/>
451 <path id="xmlschemas.path">
452 <pathelement location="${xmlschemas.dir}"/>
455 <!-- ========================================================================================
456 Path definitions for external libraries.
457 ======================================================================================== -->
459 <!-- Ignore system classpath! -->
460 <property name="build.sysclasspath" value="ignore" />
463 <property name="junit.halt.on.failure" value="false"/>
464 <property name="unitreport" value="cl-unit.xml"/>
466 <!-- DocCheck path -->
467 <property name="doccheck.home" value="${ant.lib.dir}/doccheck1.2b2/doccheck.jar"/>
468 <path id="doccheck.path">
469 <pathelement location="${doccheck.home}"/>
472 <!-- PdfDoclet path -->
473 <property name="pdfdoclet.home" value="${ant.lib.dir}/pdfdoclet-1.0.2-all.jar"/>
474 <path id="pdfdoclet.path">
475 <pathelement location="${pdfdoclet.home}"/>
478 <!-- Hibernate paths -->
479 <!-- name of the file in the source directory containing
480 the names of hibernate files to look at in the correct order -->
481 <property name="hibernate.home" value="${lib.dir}/hibernate-3.0"/>
482 <path id="hibernate.basic.path">
483 <fileset dir="${hibernate.home}">
484 <include name="*.jar"/>
486 <path refid="xerces.path"/>
487 <path refid="dom4j.path"/>
489 <path id="hibernate.appserver.path">
490 <path refid="hibernate.basic.path"/>
491 <fileset dir="${hibernate.home}/appserver">
492 <include name="*.jar"/>
495 <path id="hibernate.standalone.path">
496 <path refid="hibernate.basic.path"/>
497 <fileset dir="${hibernate.home}/standalone">
498 <include name="*.jar"/>
502 <!-- Commented the inclusion of a system-wide path in the user's environment into a
503 classpath. System wide classpaths should not be used. -->
504 <!-- property name="classpath_id" value="build.path" / -->
505 <!-- property name="classpath" refid="${classpath_id}"/ -->
506 <property name="classpath" value=""/>
509 <!-- ========================================================================================
511 ======================================================================================== -->
512 <property name="database" value="Derby"/>
516 <!-- ========================================================================================
518 ======================================================================================== -->
519 <echo level="debug" message="project.home=${project.home}"/>
520 <echo level="debug" message="project.libs=${project.libs}"/>
521 <echo level="debug" message="classpath=${classpath}"/>
524 <!-- ========================================================================================
526 ======================================================================================== -->
527 <property name="build_header_included" value="true" />
530 <!-- =================================================================
531 Sets up the directory definitions for the module
532 ================================================================= -->
533 <target name="init_directory_properties" depends="import_header">
534 <!-- Set module properties for this build -->
536 <property name="module.home" value="." />
538 <!-- Replace the dash by a / to create a relative directory
539 from a module name -->
540 <propertyregex property="module.reldir"
541 input="${module.name}"
545 defaultValue="${module.name}"/>
546 <!-- property name="module.build.dir"
547 value="${build.dir}/${module.reldir}" / -->
548 <property name="module.build.dir" value="build"/>
549 <property name="module.api.forrest.dir" value="${forrest.build.site.dir}/api/${module.name}" />
551 <isset property="webroot.dir"/>
553 <property name="module.classes.dir" value="${webroot.dir}/WEB-INF/classes" />
556 <property name="module.classes.dir" value="${module.build.dir}/bin" />
560 <property name="module.testclasses.dir" value="${module.build.dir}/testbin" />
561 <!-- Directory where generated SQL will be put by the schema export-->
562 <property name="module.sql.dir" value="${module.build.dir}/sql" />
565 <property name="module.jcovclasses.dir"
566 value="${module.build.dir}/testjcov" />
567 <property name="module.jars.dir" value="${module.build.dir}/jars" />
568 <property name="module.jar.file"
569 value="${module.jars.dir}/${module.jar.name}" />
570 <property name="module.source.dir" value="${module.home}/src" />
571 <property name="module.forrest.src.dir" value="${module.home}/xdocs" />
572 <property name="module.ejbsource.dir" value="${module.home}/ejbsrc" />
573 <property name="module.test.dir" value="${module.home}/test" />
574 <property name="module.testjar.name"
575 value="${module.name}-test.jar" />
576 <property name="module.testresourcesjar.name"
577 value="${module.name}-test-resources.jar" />
578 <property name="module.resource.dir"
579 value="${module.home}/resources" />
580 <property name="module.testresource.dir"
581 value="${module.resource.dir}/test" />
582 <property name="module.testoutput.dir"
583 value="${module.resource.dir}/testoutput"/>
584 <property name="module.report.dir"
585 value="${module.build.dir}/testresults" />
586 <property name="module.emmareport.dir"
587 value="${module.report.dir}/html/emma"/>
588 <property name="module.docbase.dir"
589 value="${module.build.dir}/docs" />
590 <property name="module.javadoc.dir"
591 value="${module.docbase.dir}/api" />
592 <property name="module.javadocjar.name"
593 value="${module.name}-doc.jar" />
594 <property name="module.testjavadocjar.name"
595 value="${module.name}-test-doc.jar" />
596 <property name="module.testjavadoc.dir"
597 value="${module.docbase.dir}/testapi" />
598 <property name="module.pdfdoc.dir"
599 value="${module.docbase.dir}/pdf" />
600 <property name="module.doccheck.dir"
601 value="${module.docbase.dir}/doccheck" />
602 <property name="module.checkstyle.dir"
603 value="${module.docbase.dir}/checkstyle" />
604 <property name="module.jar.name" value="${module.name}.jar" />
606 <!-- Replace the dash by a / to create a relative directory
607 from a module name -->
608 <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
611 <!-- ============================================================================
612 Initialize the environment for other tasks. Normally, every task which
613 does not depend on any other task should at least depend on init.
614 ============================================================================ -->
616 <target name="help" depends="import_header">
617 <antcall target="help-within-module"/>
618 <antcall target="help-outside-module"/>
621 <target name="help-within-module" depends="init_directory_properties" if="module.name">
622 <antcall target="help-impl"/>
625 <target name="help-outside-module" unless="module.name">
626 <antcall target="help-outside-module-2">
627 <param name="module.name" value="MODULE_NAME"/>
631 <target name="help-outside-module-2" depends="init_directory_properties">
632 <antcall target="help-impl"/>
636 <target name="help-impl">
641 To execute with a specific proxy host and port, start ant with the
642 command-line options -Dproxyhost=hostname -Dproxyport=portnumber.
644 deps: Download dependencies, this is necessary for using
645 any of the build targets.
646 clean-deps: Remove downloaded dependencies.
648 General build targets:
650 clean: Cleans up all build results (excluding the dist location).
651 compile: Compiles all java clasess. Target dir ${module.classes.dir}
652 jar: Creates a jar file. Target: ${module.jar.file}
653 dist: Makes the build results available for other modules Target: ${module.dist.dir}.
654 dist-lite: Similar to dist but only creates the jars for code and test code. Useful
655 during development because it takes much less time than the dist
657 clean-dist: Cleans up the dist directories.
661 test: Compile and run tests.
662 junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit)
663 reports: As junit-reports but also generates an emma test coverage
666 Note: By specifying -Dtest=TestCaseName on the ant command line,
667 only the specified testcase will be run.
669 Emma can also be executed manually:
671 emma: Overwrites the production classes by their instrumented versions.
672 emma-reports: Generates emma code coverage reports after running the
673 testcases with instrumented classes.
677 javadoc: Generates javadoc. Target: ${module.javadoc.dir}
678 doccheck: Checks documentation. Target: ${module.doccheck.dir}
682 forrest: Generates project docs using forrest.
686 checkstyle: Checks the style of the code.
687 format: Formats to the code in accordance with the checkstyle rules.
688 simian: Analyse similarities in the code.
690 Building a web application:
692 To build a web application archive (WAR) you must set the property
693 webroot.dir to the value of the directory which is the root of your
694 web application. This must be done before the header.xl is
695 sourced. The build support will then make sure that
696 classes and libs are put in the correct directories below
697 ${webroot.dir}/WEB-INF, and it will build a web archive.
699 Database targets: ** database targets are not functional yet **
701 For all targets below the database is configured using
702 hibernate.properties (hibernate.dialect property) and
703 the JDBC connection properties in database.properties.
705 The schemaexport and schemaupdate targets require the
706 setting of a property named hibernate.filelist. The value
707 of the property must be the fully qualified class name of
708 a concrete subclass of ConfigFileList which has a default
709 public constructor and defines the Hibernate mapping files that
712 schemaexport: Generate SQL code to create the required database structures.
714 startdb: Startup a lightweight database. The database
715 type to start is obtained from the currently
718 schemaupdate: Populate the database with a schema by running
719 Hibernate schemaupdate against the currently