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 <fileset dir="${test.lib.dir}" includes="emma*.jar"/>
320 <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
321 <property name="emma.enabled" value="false"/>
324 <property name="checkstyle.home" value="${ant.downloaded.lib.dir}"/>
325 <taskdef resource="checkstyletask.properties">
327 <fileset dir="${checkstyle.home}">
328 <include name="*.jar"/>
332 <property name="checkstyle.rules" value="style.xml"/>
333 <property name="checkstyle.test.rules" value="test-style.xml"/>
337 <!-- TMP download this dependence as well
338 <property name="jalopy.home" value="${lib.dir}/jalopy-ant-0.6.2"/>
339 <property name="jalopy.rules" value="${build.dir}/formatting-rules.xml"/>
340 <taskdef name="jalopy"
341 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
343 <fileset dir="${jalopy.home}">
344 <include name="*.jar" />
350 <!-- simian integration -->
351 <!-- TMP download this dependence as well
352 <property name="simian.home" value="${lib.dir}/simian"/>
353 <taskdef resource="simiantask.properties" classpath="${simian.home}/simian.jar"/>
356 <!-- macker integration -->
357 <!-- TMP download this dependence as well
358 <property name="macker.home" value="${lib.dir}/macker-0.4.2"/>
359 <path id="macker.path">
360 <fileset dir="${macker.home}">
361 <include name="**/*.jar"/>
364 <taskdef name="macker"
365 classname="net.innig.macker.ant.MackerAntTask"
366 classpathref="macker.path"/>
370 <!-- ========================================================================================
371 Locate user properties to (optionally) override defaults
372 ======================================================================================== -->
375 Give user a chance to override without editing this file
376 (and without typing -D each time they run it).
378 The following properties must be defined in this file:
379 - jcoverage.home: root of the jcoverage installation.
380 - jalopy.home: root of the jalopy installation.
382 <property name="user.property.file" value="${user.home}/wamblee.properties"/>
383 <available file="${user.property.file}" property="user.properties.found"/>
384 <property file="${user.property.file}"/>
386 <antcall target="echoUserPropertiesFileFound"/>
387 <antcall target="echoUserPropertiesFileNotFound"/>
389 <!-- project properties defaults, can be overriden in the user's properties file -->
391 <!-- The project.home property can also be overriden in a build.xml
392 in case the source is in a subdirectory and not necessarily
393 in the top-level directory -->
397 <isset property="webroot.dir"/>
399 <property name="external.lib.dir" value="${webroot.dir}/WEB-INF/lib"/>
402 <property name="external.lib.dir" value="lib/external"/>
406 <property name="build.properties.dir" value="${project.home}" />
407 <property name="build.properties.name" value="build.properties" />
409 <mkdir dir="${external.lib.dir}"/>
410 <mkdir dir="${test.lib.dir}"/>
412 <property name="conf.dir" value="conf"/>
413 <property name="log4j.properties.dir" value="${conf.dir}/properties"/>
415 <!-- Compilation properties -->
416 <property name="javac.debug" value="true"/>
417 <property name="javac.debug.level" value="lines,vars,source"/>
418 <property name="javac.source" value="1.5"/>
420 <!-- ========================================================================================
421 Standard path definitions to be used with all projects
422 ======================================================================================= -->
423 <property name="xmlschemas.dir" value="${conf.dir}/schemas"/>
424 <path id="xmlschemas.path">
425 <pathelement location="${xmlschemas.dir}"/>
428 <!-- ========================================================================================
429 Path definitions for external libraries.
430 ======================================================================================== -->
432 <!-- Ignore system classpath! -->
433 <property name="build.sysclasspath" value="ignore" />
436 <property name="junit.halt.on.failure" value="false"/>
437 <property name="unitreport" value="cl-unit.xml"/>
439 <!-- DocCheck path -->
440 <property name="doccheck.home" value="${ant.lib.dir}/doccheck1.2b2/doccheck.jar"/>
441 <path id="doccheck.path">
442 <pathelement location="${doccheck.home}"/>
445 <!-- PdfDoclet path -->
446 <property name="pdfdoclet.home" value="${ant.lib.dir}/pdfdoclet-1.0.2-all.jar"/>
447 <path id="pdfdoclet.path">
448 <pathelement location="${pdfdoclet.home}"/>
451 <!-- Hibernate paths -->
452 <!-- name of the file in the source directory containing
453 the names of hibernate files to look at in the correct order -->
454 <property name="hibernate.home" value="${lib.dir}/hibernate-3.0"/>
455 <path id="hibernate.basic.path">
456 <fileset dir="${hibernate.home}">
457 <include name="*.jar"/>
459 <path refid="xerces.path"/>
460 <path refid="dom4j.path"/>
462 <path id="hibernate.appserver.path">
463 <path refid="hibernate.basic.path"/>
464 <fileset dir="${hibernate.home}/appserver">
465 <include name="*.jar"/>
468 <path id="hibernate.standalone.path">
469 <path refid="hibernate.basic.path"/>
470 <fileset dir="${hibernate.home}/standalone">
471 <include name="*.jar"/>
475 <!-- Commented the inclusion of a system-wide path in the user's environment into a
476 classpath. System wide classpaths should not be used. -->
477 <!-- property name="classpath_id" value="build.path" / -->
478 <!-- property name="classpath" refid="${classpath_id}"/ -->
479 <property name="classpath" value=""/>
482 <!-- ========================================================================================
484 ======================================================================================== -->
485 <property name="database" value="Derby"/>
489 <!-- ========================================================================================
491 ======================================================================================== -->
492 <echo level="debug" message="project.home=${project.home}"/>
493 <echo level="debug" message="project.libs=${project.libs}"/>
494 <echo level="debug" message="classpath=${classpath}"/>
497 <!-- ========================================================================================
499 ======================================================================================== -->
500 <property name="build_header_included" value="true" />
503 <!-- =================================================================
504 Sets up the directory definitions for the module
505 ================================================================= -->
506 <target name="init_directory_properties" depends="import_header">
507 <!-- Set module properties for this build -->
509 <property name="module.home" value="." />
511 <!-- Replace the dash by a / to create a relative directory
512 from a module name -->
513 <propertyregex property="module.reldir"
514 input="${module.name}"
518 defaultValue="${module.name}"/>
519 <!-- property name="module.build.dir"
520 value="${build.dir}/${module.reldir}" / -->
521 <property name="module.build.dir" value="build"/>
522 <property name="module.api.forrest.dir" value="${forrest.build.site.dir}/api/${module.name}" />
524 <isset property="webroot.dir"/>
526 <property name="module.classes.dir" value="${webroot.dir}/WEB-INF/classes" />
529 <property name="module.classes.dir" value="${module.build.dir}/bin" />
533 <property name="module.testclasses.dir" value="${module.build.dir}/testbin" />
534 <!-- Directory where generated SQL will be put by the schema export-->
535 <property name="module.sql.dir" value="${module.build.dir}/sql" />
538 <property name="module.jcovclasses.dir"
539 value="${module.build.dir}/testjcov" />
540 <property name="module.jars.dir" value="${module.build.dir}/jars" />
541 <property name="module.jar.file"
542 value="${module.jars.dir}/${module.jar.name}" />
543 <property name="module.source.dir" value="${module.home}/src" />
544 <property name="module.forrest.src.dir" value="${module.home}/xdocs" />
545 <property name="module.ejbsource.dir" value="${module.home}/ejbsrc" />
546 <property name="module.test.dir" value="${module.home}/test" />
547 <property name="module.testjar.name"
548 value="${module.name}-test.jar" />
549 <property name="module.testresourcesjar.name"
550 value="${module.name}-test-resources.jar" />
551 <property name="module.resource.dir"
552 value="${module.home}/resources" />
553 <property name="module.testresource.dir"
554 value="${module.resource.dir}/test" />
555 <property name="module.testoutput.dir"
556 value="${module.resource.dir}/testoutput"/>
557 <property name="module.report.dir"
558 value="${module.build.dir}/testresults" />
559 <property name="module.emmareport.dir"
560 value="${module.report.dir}/html/emma"/>
561 <property name="module.docbase.dir"
562 value="${module.build.dir}/docs" />
563 <property name="module.javadoc.dir"
564 value="${module.docbase.dir}/api" />
565 <property name="module.javadocjar.name"
566 value="${module.name}-doc.jar" />
567 <property name="module.testjavadocjar.name"
568 value="${module.name}-test-doc.jar" />
569 <property name="module.testjavadoc.dir"
570 value="${module.docbase.dir}/testapi" />
571 <property name="module.pdfdoc.dir"
572 value="${module.docbase.dir}/pdf" />
573 <property name="module.doccheck.dir"
574 value="${module.docbase.dir}/doccheck" />
575 <property name="module.checkstyle.dir"
576 value="${module.docbase.dir}/checkstyle" />
577 <property name="module.jar.name" value="${module.name}.jar" />
579 <!-- Replace the dash by a / to create a relative directory
580 from a module name -->
581 <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
584 <!-- ============================================================================
585 Initialize the environment for other tasks. Normally, every task which
586 does not depend on any other task should at least depend on init.
587 ============================================================================ -->
589 <target name="help" depends="import_header">
590 <antcall target="help-within-module"/>
591 <antcall target="help-outside-module"/>
594 <target name="help-within-module" depends="init_directory_properties" if="module.name">
595 <antcall target="help-impl"/>
598 <target name="help-outside-module" unless="module.name">
599 <antcall target="help-outside-module-2">
600 <param name="module.name" value="MODULE_NAME"/>
604 <target name="help-outside-module-2" depends="init_directory_properties">
605 <antcall target="help-impl"/>
609 <target name="help-impl">
614 To execute with a specific proxy host and port, start ant with the
615 command-line options -Dproxyhost=hostname -Dproxyport=portnumber.
617 deps: Download dependencies, this is necessary for using
618 any of the build targets.
619 clean-deps: Remove downloaded dependencies.
621 General build targets:
623 clean: Cleans up all build results (excluding the dist location).
624 compile: Compiles all java clasess. Target dir ${module.classes.dir}
625 jar: Creates a jar file. Target: ${module.jar.file}
626 dist: Makes the build results available for other modules Target: ${module.dist.dir}.
627 dist-lite: Similar to dist but only creates the jars for code and test code. Useful
628 during development because it takes much less time than the dist
630 clean-dist: Cleans up the dist directories.
634 test: Compile and run tests.
635 junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit)
636 reports: As junit-reports but also generates an emma test coverage
639 Note: By specifying -Dtest=TestCaseName on the ant command line,
640 only the specified testcase will be run.
642 Emma can also be executed manually:
644 emma: Overwrites the production classes by their instrumented versions.
645 emma-reports: Generates emma code coverage reports after running the
646 testcases with instrumented classes.
650 javadoc: Generates javadoc. Target: ${module.javadoc.dir}
651 doccheck: Checks documentation. Target: ${module.doccheck.dir}
655 forrest: Generates project docs using forrest.
659 checkstyle: Checks the style of the code.
660 format: Formats to the code in accordance with the checkstyle rules.
661 simian: Analyse similarities in the code.
663 Building a web application:
665 To build a web application archive (WAR) you must set the property
666 webroot.dir to the value of the directory which is the root of your
667 web application. This must be done before the header.xl is
668 sourced. The build support will then make sure that
669 classes and libs are put in the correct directories below
670 ${webroot.dir}/WEB-INF, and it will build a web archive.
672 Database targets: ** database targets are not functional yet **
674 For all targets below the database is configured using
675 hibernate.properties (hibernate.dialect property) and
676 the JDBC connection properties in database.properties.
678 The schemaexport and schemaupdate targets require the
679 setting of a property named hibernate.filelist. The value
680 of the property must be the fully qualified class name of
681 a concrete subclass of ConfigFileList which has a default
682 public constructor and defines the Hibernate mapping files that
685 schemaexport: Generate SQL code to create the required database structures.
687 startdb: Startup a lightweight database. The database
688 type to start is obtained from the currently
691 schemaupdate: Populate the database with a schema by running
692 Hibernate schemaupdate against the currently