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="ehcache.d">
137 <antcall target="download.dep">
138 <param name="group" value="ehcache"/>
139 <param name="version" value="1.1"/>
143 <target name="xerces.d">
144 <antcall target="download.dep">
145 <param name="group" value="xerces"/>
146 <param name="version" value="2.4.0"/>
150 <target name="oro.d">
151 <antcall target="download.dep">
152 <param name="group" value="oro"/>
153 <param name="version" value="2.0.6"/>
157 <target name="cglib.d">
158 <antcall target="download.dep">
159 <param name="group" value="cglib"/>
160 <param name="version" value="2.1"/>
164 <target name="hibernate.d" depends="cglib.d,oro.d">
165 <antcall target="download.dep">
166 <param name="group" value="hibernate"/>
167 <param name="version" value="3.0.5"/>
171 <target name="hibernate.standalone.d" depends="hibernate.d">
172 <copy todir="${download.dir}">
173 <fileset dir="${special.lib.dir}/hibernate">
174 <include name="*.jar"/>
179 <target name="spring.d">
180 <antcall target="download.dep">
181 <param name="group" value="springframework"/>
182 <param name="artifact" value="spring"/>
183 <param name="version" value="1.2.5"/>
187 <target name="activation.d">
188 <copy todir="${download.dir}">
189 <fileset dir="${special.lib.dir}/jaf-1.0.2">
190 <include name="*.jar"/>
195 <target name="mail.d" depends="activation.d">
196 <copy todir="${download.dir}">
197 <fileset dir="${special.lib.dir}/javamail-1.3.3_01">
198 <include name="*.jar"/>
205 <target name="httpclient.d">
206 <antcall target="download.dep">
207 <param name="group" value="commons-httpclient"/>
208 <param name="version" value="3.0"/>
212 <target name="jtidy.d">
213 <antcall target="download.dep">
214 <param name="group" value="jtidy"/>
215 <param name="version" value="4aug2000r7-dev"/>
219 <property name="support.dist.dir" value="${lib.dir}/wamblee/support"/>
220 <target name="wamblee.support.d">
221 <copy todir="${download.dir}">
222 <fileset dir="${support.dist.dir}">
223 <include name="wamblee-support.jar"/>
227 <target name="wamblee.support.test.d">
228 <copy todir="${download.dir}">
229 <fileset dir="${support.dist.dir}">
230 <include name="wamblee-support-test.jar"/>
236 <target name="junit.d">
237 <antcall target="download.dep">
238 <param name="group" value="junit"/>
239 <param name="version" value="3.8.1"/>
241 <copy todir="${download.dir}">
242 <fileset dir="${special.lib.dir}/test">
243 <include name="*.jar"/>
248 <target name="emma.d">
249 <antcall target="download.dep">
250 <param name="group" value="emma"/>
251 <param name="artifact" value="emma"/>
252 <param name="version" value="2.0.5312"/>
254 <antcall target="download.dep">
255 <param name="group" value="emma"/>
256 <param name="artifact" value="emma_ant"/>
257 <param name="version" value="2.0.5312"/>
261 <target name="jmock.d">
262 <antcall target="download.dep">
263 <param name="group" value="jmock"/>
264 <param name="artifact" value="jmock"/>
265 <param name="version" value="1.0.1"/>
267 <antcall target="download.dep">
268 <param name="group" value="jmock"/>
269 <param name="artifact" value="jmock-cglib"/>
270 <param name="version" value="1.0.1"/>
274 <target name="dbunit.d">
275 <antcall target="download.dep">
276 <param name="group" value="dbunit"/>
277 <param name="version" value="2.1"/>
282 <target name="antlr.d">
283 <antcall target="download.dep">
284 <param name="group" value="antlr"/>
285 <param name="version" value="2.7.2"/>
289 <target name="checkstyle.d" depends="antlr.d,commons-beanutils.d,commons-logging.d,commons-collections.d">
290 <antcall target="download.dep">
291 <param name="group" value="checkstyle"/>
292 <param name="version" value="4.1"/>
296 <!-- common test dependencies for all test code -->
297 <target name="test.d" depends="junit.d,jmock.d,dbunit.d,emma.d">
300 <!-- downloaded dependencies for ant tasks -->
301 <target name="ant.d" depends="checkstyle.d">
306 <target name="import_header" unless="build_header_included">
308 <property name="ant.lib.dir" value="${build.dir}/lib/ant"/>
309 <property name="test.lib.dir" value="lib/test"/>
310 <property name="special.lib.dir" value="${build.dir}/lib/special"/>
311 <property name="ant.downloaded.lib.dir" value="${build.dir}/lib/ant/downloaded"/>
314 <!-- ========================================================================================
316 ======================================================================================== -->
318 <!-- ant-contrib integration -->
319 <property name="ant.contrib.home" value="${ant.lib.dir}/ant-contrib-1.0b2"/>
320 <taskdef resource="net/sf/antcontrib/antlib.xml">
322 <pathelement location="${ant.contrib.home}/ant-contrib.jar" />
326 <!-- taskdef for ant-dependencies task -->
327 <taskdef name="dependencies" classpath="${ant.lib.dir}/ant-dependencies.jar"
328 classname="org.apache.tools.ant.taskdefs.optional.dependencies.Dependencies"/>
330 <!-- Emma integration -->
332 <available file="${test.lib.dir}"/>
335 <fileset dir="${test.lib.dir}" includes="emma*.jar"/>
337 <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
338 <property name="emma.enabled" value="false"/>
343 <property name="checkstyle.home" value="${ant.downloaded.lib.dir}"/>
344 <taskdef resource="checkstyletask.properties">
346 <fileset dir="${checkstyle.home}">
347 <include name="*.jar"/>
351 <property name="checkstyle.rules" value="style.xml"/>
352 <property name="checkstyle.test.rules" value="test-style.xml"/>
356 <!-- TMP download this dependence as well
357 <property name="jalopy.home" value="${lib.dir}/jalopy-ant-0.6.2"/>
358 <property name="jalopy.rules" value="${build.dir}/formatting-rules.xml"/>
359 <taskdef name="jalopy"
360 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
362 <fileset dir="${jalopy.home}">
363 <include name="*.jar" />
369 <!-- simian integration -->
370 <!-- TMP download this dependence as well
371 <property name="simian.home" value="${lib.dir}/simian"/>
372 <taskdef resource="simiantask.properties" classpath="${simian.home}/simian.jar"/>
375 <!-- macker integration -->
376 <!-- TMP download this dependence as well
377 <property name="macker.home" value="${lib.dir}/macker-0.4.2"/>
378 <path id="macker.path">
379 <fileset dir="${macker.home}">
380 <include name="**/*.jar"/>
383 <taskdef name="macker"
384 classname="net.innig.macker.ant.MackerAntTask"
385 classpathref="macker.path"/>
389 <!-- ========================================================================================
390 Locate user properties to (optionally) override defaults
391 ======================================================================================== -->
394 Give user a chance to override without editing this file
395 (and without typing -D each time they run it).
397 The following properties must be defined in this file:
398 - jcoverage.home: root of the jcoverage installation.
399 - jalopy.home: root of the jalopy installation.
401 <property name="user.property.file" value="${user.home}/wamblee.properties"/>
402 <available file="${user.property.file}" property="user.properties.found"/>
403 <property file="${user.property.file}"/>
405 <antcall target="echoUserPropertiesFileFound"/>
406 <antcall target="echoUserPropertiesFileNotFound"/>
408 <!-- project properties defaults, can be overriden in the user's properties file -->
410 <!-- The project.home property can also be overriden in a build.xml
411 in case the source is in a subdirectory and not necessarily
412 in the top-level directory -->
416 <isset property="webroot.dir"/>
418 <property name="external.lib.dir" value="${webroot.dir}/WEB-INF/lib"/>
421 <property name="external.lib.dir" value="lib/external"/>
425 <property name="build.properties.dir" value="${project.home}" />
426 <property name="build.properties.name" value="build.properties" />
428 <mkdir dir="${external.lib.dir}"/>
429 <mkdir dir="${test.lib.dir}"/>
431 <property name="conf.dir" value="conf"/>
432 <property name="log4j.properties.dir" value="${conf.dir}/properties"/>
434 <!-- Compilation properties -->
435 <property name="javac.debug" value="true"/>
436 <property name="javac.debug.level" value="lines,vars,source"/>
437 <property name="javac.source" value="1.5"/>
439 <!-- ========================================================================================
440 Standard path definitions to be used with all projects
441 ======================================================================================= -->
442 <property name="xmlschemas.dir" value="${conf.dir}/schemas"/>
443 <path id="xmlschemas.path">
444 <pathelement location="${xmlschemas.dir}"/>
447 <!-- ========================================================================================
448 Path definitions for external libraries.
449 ======================================================================================== -->
451 <!-- Ignore system classpath! -->
452 <property name="build.sysclasspath" value="ignore" />
455 <property name="junit.halt.on.failure" value="false"/>
456 <property name="unitreport" value="cl-unit.xml"/>
458 <!-- DocCheck path -->
459 <property name="doccheck.home" value="${ant.lib.dir}/doccheck1.2b2/doccheck.jar"/>
460 <path id="doccheck.path">
461 <pathelement location="${doccheck.home}"/>
464 <!-- PdfDoclet path -->
465 <property name="pdfdoclet.home" value="${ant.lib.dir}/pdfdoclet-1.0.2-all.jar"/>
466 <path id="pdfdoclet.path">
467 <pathelement location="${pdfdoclet.home}"/>
470 <!-- Hibernate paths -->
471 <!-- name of the file in the source directory containing
472 the names of hibernate files to look at in the correct order -->
473 <property name="hibernate.home" value="${lib.dir}/hibernate-3.0"/>
474 <path id="hibernate.basic.path">
475 <fileset dir="${hibernate.home}">
476 <include name="*.jar"/>
478 <path refid="xerces.path"/>
479 <path refid="dom4j.path"/>
481 <path id="hibernate.appserver.path">
482 <path refid="hibernate.basic.path"/>
483 <fileset dir="${hibernate.home}/appserver">
484 <include name="*.jar"/>
487 <path id="hibernate.standalone.path">
488 <path refid="hibernate.basic.path"/>
489 <fileset dir="${hibernate.home}/standalone">
490 <include name="*.jar"/>
494 <!-- Commented the inclusion of a system-wide path in the user's environment into a
495 classpath. System wide classpaths should not be used. -->
496 <!-- property name="classpath_id" value="build.path" / -->
497 <!-- property name="classpath" refid="${classpath_id}"/ -->
498 <property name="classpath" value=""/>
501 <!-- ========================================================================================
503 ======================================================================================== -->
504 <property name="database" value="Derby"/>
508 <!-- ========================================================================================
510 ======================================================================================== -->
511 <echo level="debug" message="project.home=${project.home}"/>
512 <echo level="debug" message="project.libs=${project.libs}"/>
513 <echo level="debug" message="classpath=${classpath}"/>
516 <!-- ========================================================================================
518 ======================================================================================== -->
519 <property name="build_header_included" value="true" />
522 <!-- =================================================================
523 Sets up the directory definitions for the module
524 ================================================================= -->
525 <target name="init_directory_properties" depends="import_header">
526 <!-- Set module properties for this build -->
528 <property name="module.home" value="." />
530 <!-- Replace the dash by a / to create a relative directory
531 from a module name -->
532 <propertyregex property="module.reldir"
533 input="${module.name}"
537 defaultValue="${module.name}"/>
538 <!-- property name="module.build.dir"
539 value="${build.dir}/${module.reldir}" / -->
540 <property name="module.build.dir" value="build"/>
541 <property name="module.api.forrest.dir" value="${forrest.build.site.dir}/api/${module.name}" />
543 <isset property="webroot.dir"/>
545 <property name="module.classes.dir" value="${webroot.dir}/WEB-INF/classes" />
548 <property name="module.classes.dir" value="${module.build.dir}/bin" />
552 <property name="module.testclasses.dir" value="${module.build.dir}/testbin" />
553 <!-- Directory where generated SQL will be put by the schema export-->
554 <property name="module.sql.dir" value="${module.build.dir}/sql" />
557 <property name="module.jcovclasses.dir"
558 value="${module.build.dir}/testjcov" />
559 <property name="module.jars.dir" value="${module.build.dir}/jars" />
560 <property name="module.jar.file"
561 value="${module.jars.dir}/${module.jar.name}" />
562 <property name="module.source.dir" value="${module.home}/src" />
563 <property name="module.forrest.src.dir" value="${module.home}/xdocs" />
564 <property name="module.ejbsource.dir" value="${module.home}/ejbsrc" />
565 <property name="module.test.dir" value="${module.home}/test" />
566 <property name="module.testjar.name"
567 value="${module.name}-test.jar" />
568 <property name="module.testresourcesjar.name"
569 value="${module.name}-test-resources.jar" />
570 <property name="module.resource.dir"
571 value="${module.home}/resources" />
572 <property name="module.testresource.dir"
573 value="${module.resource.dir}/test" />
574 <property name="module.testoutput.dir"
575 value="${module.resource.dir}/testoutput"/>
576 <property name="module.report.dir"
577 value="${module.build.dir}/testresults" />
578 <property name="module.emmareport.dir"
579 value="${module.report.dir}/html/emma"/>
580 <property name="module.docbase.dir"
581 value="${module.build.dir}/docs" />
582 <property name="module.javadoc.dir"
583 value="${module.docbase.dir}/api" />
584 <property name="module.javadocjar.name"
585 value="${module.name}-doc.jar" />
586 <property name="module.testjavadocjar.name"
587 value="${module.name}-test-doc.jar" />
588 <property name="module.testjavadoc.dir"
589 value="${module.docbase.dir}/testapi" />
590 <property name="module.pdfdoc.dir"
591 value="${module.docbase.dir}/pdf" />
592 <property name="module.doccheck.dir"
593 value="${module.docbase.dir}/doccheck" />
594 <property name="module.checkstyle.dir"
595 value="${module.docbase.dir}/checkstyle" />
596 <property name="module.jar.name" value="${module.name}.jar" />
598 <!-- Replace the dash by a / to create a relative directory
599 from a module name -->
600 <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
603 <!-- ============================================================================
604 Initialize the environment for other tasks. Normally, every task which
605 does not depend on any other task should at least depend on init.
606 ============================================================================ -->
608 <target name="help" depends="import_header">
609 <antcall target="help-within-module"/>
610 <antcall target="help-outside-module"/>
613 <target name="help-within-module" depends="init_directory_properties" if="module.name">
614 <antcall target="help-impl"/>
617 <target name="help-outside-module" unless="module.name">
618 <antcall target="help-outside-module-2">
619 <param name="module.name" value="MODULE_NAME"/>
623 <target name="help-outside-module-2" depends="init_directory_properties">
624 <antcall target="help-impl"/>
628 <target name="help-impl">
633 To execute with a specific proxy host and port, start ant with the
634 command-line options -Dproxyhost=hostname -Dproxyport=portnumber.
636 deps: Download dependencies, this is necessary for using
637 any of the build targets.
638 clean-deps: Remove downloaded dependencies.
640 General build targets:
642 clean: Cleans up all build results (excluding the dist location).
643 compile: Compiles all java clasess. Target dir ${module.classes.dir}
644 jar: Creates a jar file. Target: ${module.jar.file}
645 dist: Makes the build results available for other modules Target: ${module.dist.dir}.
646 dist-lite: Similar to dist but only creates the jars for code and test code. Useful
647 during development because it takes much less time than the dist
649 clean-dist: Cleans up the dist directories.
653 test: Compile and run tests.
654 junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit)
655 reports: As junit-reports but also generates an emma test coverage
658 Note: By specifying -Dtest=TestCaseName on the ant command line,
659 only the specified testcase will be run.
661 Emma can also be executed manually:
663 emma: Overwrites the production classes by their instrumented versions.
664 emma-reports: Generates emma code coverage reports after running the
665 testcases with instrumented classes.
669 javadoc: Generates javadoc. Target: ${module.javadoc.dir}
670 doccheck: Checks documentation. Target: ${module.doccheck.dir}
674 forrest: Generates project docs using forrest.
678 checkstyle: Checks the style of the code.
679 format: Formats to the code in accordance with the checkstyle rules.
680 simian: Analyse similarities in the code.
682 Building a web application:
684 To build a web application archive (WAR) you must set the property
685 webroot.dir to the value of the directory which is the root of your
686 web application. This must be done before the header.xl is
687 sourced. The build support will then make sure that
688 classes and libs are put in the correct directories below
689 ${webroot.dir}/WEB-INF, and it will build a web archive.
691 Database targets: ** database targets are not functional yet **
693 For all targets below the database is configured using
694 hibernate.properties (hibernate.dialect property) and
695 the JDBC connection properties in database.properties.
697 The schemaexport and schemaupdate targets require the
698 setting of a property named hibernate.filelist. The value
699 of the property must be the fully qualified class name of
700 a concrete subclass of ConfigFileList which has a default
701 public constructor and defines the Hibernate mapping files that
704 schemaexport: Generate SQL code to create the required database structures.
706 startdb: Startup a lightweight database. The database
707 type to start is obtained from the currently
710 schemaupdate: Populate the database with a schema by running
711 Hibernate schemaupdate against the currently