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>
13 <target name="download.dep">
15 <isset property="artifact"/>
17 <echo>Getting dependence ${group}/${artifact}/${version}</echo>
18 <dependencies verbose="true" fileSetId="my.deps">
19 <dependency group="${group}" artifact="${artifact}" version="${version}"/>
21 <copy todir="${download.dir}" flatten="yes">
22 <fileset refid="my.deps"/>
26 <echo>Getting dependence ${group}/${version}</echo>
27 <dependencies verbose="true" fileSetId="my.deps">
28 <dependency group="${group}" version="${version}"/>
30 <copy todir="${download.dir}" flatten="yes">
31 <fileset refid="my.deps"/>
38 <target name="log4j.d">
39 <antcall target="download.dep">
40 <param name="group" value="log4j"/>
41 <param name="version" value="1.2.9"/>
45 <target name="commons-beanutils.d">
46 <antcall target="download.dep">
47 <param name="group" value="commons-beanutils"/>
48 <param name="version" value="1.7.0"/>
52 <target name="commons-collections.d">
53 <antcall target="download.dep">
54 <param name="group" value="commons-collections"/>
55 <param name="version" value="3.1"/>
60 <target name="commons-logging.d">
61 <antcall target="download.dep">
62 <param name="group" value="commons-logging"/>
63 <param name="artifact" value="commons-logging"/>
64 <param name="version" value="1.0.2"/>
68 <target name="logging.d" depends="log4j.d,commons-logging.d">
71 <target name="dom4j.d">
72 <antcall target="download.dep">
73 <param name="group" value="dom4j"/>
74 <param name="version" value="1.6"/>
78 <target name="xerces.d">
79 <antcall target="download.dep">
80 <param name="group" value="ehcache"/>
81 <param name="version" value="1.1"/>
85 <target name="ehcache.d">
86 <antcall target="download.dep">
87 <param name="group" value="xerces"/>
88 <param name="version" value="2.4.0"/>
93 <antcall target="download.dep">
94 <param name="group" value="oro"/>
95 <param name="version" value="2.0.6"/>
99 <target name="cglib.d">
100 <antcall target="download.dep">
101 <param name="group" value="cglib"/>
102 <param name="version" value="2.1"/>
106 <target name="hibernate.d" depends="cglib.d,oro.d">
107 <antcall target="download.dep">
108 <param name="group" value="hibernate"/>
109 <param name="version" value="3.0.5"/>
113 <target name="hibernate.standalone.d" depends="hibernate.d">
114 <copy todir="${download.dir}">
115 <fileset dir="${special.lib.dir}/hibernate">
116 <include name="*.jar"/>
121 <target name="spring.d">
122 <antcall target="download.dep">
123 <param name="group" value="springframework"/>
124 <param name="artifact" value="spring"/>
125 <param name="version" value="1.2.5"/>
129 <target name="junit.d">
130 <antcall target="download.dep">
131 <param name="group" value="junit"/>
132 <param name="version" value="3.8.1"/>
134 <copy todir="${download.dir}">
135 <fileset dir="${special.lib.dir}/test">
136 <include name="*.jar"/>
141 <target name="emma.d">
142 <antcall target="download.dep">
143 <param name="group" value="emma"/>
144 <param name="artifact" value="emma"/>
145 <param name="version" value="2.0.5312"/>
147 <antcall target="download.dep">
148 <param name="group" value="emma"/>
149 <param name="artifact" value="emma_ant"/>
150 <param name="version" value="2.0.5312"/>
154 <target name="jmock.d">
155 <antcall target="download.dep">
156 <param name="group" value="jmock"/>
157 <param name="artifact" value="jmock"/>
158 <param name="version" value="1.0.1"/>
160 <antcall target="download.dep">
161 <param name="group" value="jmock"/>
162 <param name="artifact" value="jmock-cglib"/>
163 <param name="version" value="1.0.1"/>
167 <target name="dbunit.d">
168 <antcall target="download.dep">
169 <param name="group" value="dbunit"/>
170 <param name="version" value="2.1"/>
175 <target name="antlr.d">
176 <antcall target="download.dep">
177 <param name="group" value="antlr"/>
178 <param name="version" value="2.7.2"/>
182 <target name="checkstyle.d" depends="antlr.d,commons-beanutils.d,commons-logging.d,commons-collections.d">
183 <antcall target="download.dep">
184 <param name="group" value="checkstyle"/>
185 <param name="version" value="4.1"/>
189 <!-- common test dependencies for all test code -->
190 <target name="test.d" depends="junit.d,jmock.d,dbunit.d,emma.d">
193 <!-- downloaded dependencies for ant tasks -->
194 <target name="ant.d" depends="checkstyle.d">
199 <target name="import_header" unless="build_header_included">
201 <!-- ========================================================================================
202 Locate user properties to (optionally) override defaults
203 ======================================================================================== -->
206 Give user a chance to override without editing this file
207 (and without typing -D each time they run it).
209 The following properties must be defined in this file:
210 - jcoverage.home: root of the jcoverage installation.
211 - jalopy.home: root of the jalopy installation.
213 <property name="user.property.file" value="${user.home}/wamblee.properties"/>
214 <available file="${user.property.file}" property="user.properties.found"/>
215 <property file="${user.property.file}"/>
217 <antcall target="echoUserPropertiesFileFound"/>
218 <antcall target="echoUserPropertiesFileNotFound"/>
220 <!-- project properties defaults, can be overriden in the user's properties file -->
222 <!-- The project.home property can also be overriden in a build.xml
223 in case the source is in a subdirectory and not necessarily
224 in the top-level directory -->
225 <property name="project.home" value=".."/>
226 <property name="build.dir" value="${project.home}/build"/>
227 <property name="lib.dir" value="${project.home}/lib/wamblee"/>
228 <property name="ant.lib.dir" value="${project.home}/lib/ant"/>
229 <property name="ant.downloaded.lib.dir" value="${project.home}/lib/ant/downloaded"/>
230 <property name="external.lib.dir" value="lib/external"/>
231 <property name="test.lib.dir" value="lib/test"/>
232 <property name="special.lib.dir" value="${project.home}/lib/special"/>
233 <property name="forrest.xdocs.dir" value="${project.home}/site/xdocs"/>
234 <property name="forrest.build.dir" value="${project.home}/site/build"/>
235 <property name="forrest.build.site.dir" value="${forrest.build.dir}/site"/>
236 <property name="build.properties.dir" value="${project.home}" />
237 <property name="build.properties.name" value="build.properties" />
239 <mkdir dir="${external.lib.dir}"/>
240 <mkdir dir="${test.lib.dir}"/>
242 <property name="conf.dir" value="conf"/>
243 <property name="log4j.properties.dir" value="${conf.dir}/properties"/>
245 <!-- Compilation properties -->
246 <property name="javac.debug" value="true"/>
247 <property name="javac.debug.level" value="lines,vars,source"/>
248 <property name="javac.source" value="1.5"/>
250 <!-- ========================================================================================
251 Standard path definitions to be used with all projects
252 ======================================================================================= -->
253 <property name="xmlschemas.dir" value="${conf.dir}/schemas"/>
254 <path id="xmlschemas.path">
255 <pathelement location="${xmlschemas.dir}"/>
258 <!-- ========================================================================================
259 Path definitions for external libraries.
260 ======================================================================================== -->
262 <!-- Ignore system classpath! -->
263 <property name="build.sysclasspath" value="ignore" />
266 <property name="junit.halt.on.failure" value="false"/>
267 <property name="unitreport" value="cl-unit.xml"/>
269 <!-- DocCheck path -->
270 <property name="doccheck.home" value="${ant.lib.dir}/doccheck1.2b2/doccheck.jar"/>
271 <path id="doccheck.path">
272 <pathelement location="${doccheck.home}"/>
275 <!-- PdfDoclet path -->
276 <property name="pdfdoclet.home" value="${ant.lib.dir}/pdfdoclet-1.0.2-all.jar"/>
277 <path id="pdfdoclet.path">
278 <pathelement location="${pdfdoclet.home}"/>
281 <!-- Hibernate paths -->
282 <!-- name of the file in the source directory containing
283 the names of hibernate files to look at in the correct order -->
284 <property name="hibernate.home" value="${lib.dir}/hibernate-3.0"/>
285 <path id="hibernate.basic.path">
286 <fileset dir="${hibernate.home}">
287 <include name="*.jar"/>
289 <path refid="xerces.path"/>
290 <path refid="dom4j.path"/>
292 <path id="hibernate.appserver.path">
293 <path refid="hibernate.basic.path"/>
294 <fileset dir="${hibernate.home}/appserver">
295 <include name="*.jar"/>
298 <path id="hibernate.standalone.path">
299 <path refid="hibernate.basic.path"/>
300 <fileset dir="${hibernate.home}/standalone">
301 <include name="*.jar"/>
305 <!-- Commented the inclusion of a system-wide path in the user's environment into a
306 classpath. System wide classpaths should not be used. -->
307 <!-- property name="classpath_id" value="build.path" / -->
308 <!-- property name="classpath" refid="${classpath_id}"/ -->
309 <property name="classpath" value=""/>
312 <!-- ========================================================================================
314 ======================================================================================== -->
315 <property name="database" value="Derby"/>
317 <!-- ========================================================================================
319 ======================================================================================== -->
321 <!-- ant-contrib integration -->
322 <property name="ant.contrib.home" value="${ant.lib.dir}/ant-contrib-1.0b2"/>
323 <taskdef resource="net/sf/antcontrib/antlib.xml">
325 <pathelement location="${ant.contrib.home}/ant-contrib.jar" />
329 <!-- taskdef for ant-dependencies task -->
330 <taskdef name="dependencies" classpath="${ant.lib.dir}/ant-dependencies.jar"
331 classname="org.apache.tools.ant.taskdefs.optional.dependencies.Dependencies"/>
333 <!-- Emma integration -->
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"/>
341 <property name="checkstyle.home" value="${ant.downloaded.lib.dir}"/>
342 <taskdef resource="checkstyletask.properties">
344 <fileset dir="${checkstyle.home}">
345 <include name="*.jar"/>
349 <property name="checkstyle.rules" value="style.xml"/>
350 <property name="checkstyle.test.rules" value="test-style.xml"/>
354 <!-- TMP download this dependence as well
355 <property name="jalopy.home" value="${lib.dir}/jalopy-ant-0.6.2"/>
356 <property name="jalopy.rules" value="${build.dir}/formatting-rules.xml"/>
357 <taskdef name="jalopy"
358 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
360 <fileset dir="${jalopy.home}">
361 <include name="*.jar" />
367 <!-- simian integration -->
368 <!-- TMP download this dependence as well
369 <property name="simian.home" value="${lib.dir}/simian"/>
370 <taskdef resource="simiantask.properties" classpath="${simian.home}/simian.jar"/>
373 <!-- macker integration -->
374 <!-- TMP download this dependence as well
375 <property name="macker.home" value="${lib.dir}/macker-0.4.2"/>
376 <path id="macker.path">
377 <fileset dir="${macker.home}">
378 <include name="**/*.jar"/>
381 <taskdef name="macker"
382 classname="net.innig.macker.ant.MackerAntTask"
383 classpathref="macker.path"/>
387 <!-- ========================================================================================
389 ======================================================================================== -->
390 <echo level="debug" message="project.home=${project.home}"/>
391 <echo level="debug" message="project.libs=${project.libs}"/>
392 <echo level="debug" message="classpath=${classpath}"/>
395 <!-- ========================================================================================
397 ======================================================================================== -->
398 <property name="build_header_included" value="true" />
401 <!-- =================================================================
402 Sets up the directory definitions for the module
403 ================================================================= -->
404 <target name="init_directory_properties" depends="import_header">
405 <!-- Set module properties for this build -->
407 <property name="module.home" value="." />
409 <!-- Replace the dash by a / to create a relative directory
410 from a module name -->
411 <propertyregex property="module.reldir"
412 input="${module.name}"
416 defaultValue="${module.name}"/>
417 <property name="module.build.dir"
418 value="${build.dir}/${module.reldir}" />
420 <property name="module.api.forrest.dir" value="${forrest.build.site.dir}/api/${module.name}" />
421 <!-- property name="module.classes.dir" value="${module.build.dir}/bin"/ -->
422 <!-- property name="module.testclasses.dir" value="${module.build.dir}/testbin"/ -->
423 <property name="module.classes.dir" value="bin" />
424 <property name="module.testclasses.dir" value="testbin" />
425 <!-- Directory where generated SQL will be put by the schema export-->
426 <property name="module.sql.dir" value="${module.build.dir}/sql" />
429 <property name="module.jcovclasses.dir"
430 value="${module.build.dir}/testjcov" />
431 <property name="module.jars.dir" value="${module.build.dir}/jars" />
432 <property name="module.jar.file"
433 value="${module.jars.dir}/${module.jar.name}" />
434 <property name="module.source.dir" value="${module.home}/src" />
435 <property name="module.forrest.src.dir" value="${module.home}/xdocs" />
436 <property name="module.ejbsource.dir" value="${module.home}/ejbsrc" />
437 <property name="module.test.dir" value="${module.home}/test" />
438 <property name="module.testjar.name"
439 value="${module.name}-test.jar" />
440 <property name="module.testresourcesjar.name"
441 value="${module.name}-test-resources.jar" />
442 <property name="module.resource.dir"
443 value="${module.home}/resources" />
444 <property name="module.testresource.dir"
445 value="${module.resource.dir}/test" />
446 <property name="module.testoutput.dir"
447 value="${module.resource.dir}/testoutput"/>
448 <property name="module.report.dir"
449 value="${module.build.dir}/testresults" />
450 <property name="module.emmareport.dir"
451 value="${module.report.dir}/html/emma"/>
452 <property name="module.docbase.dir"
453 value="${module.build.dir}/javadoc" />
454 <property name="module.javadoc.dir"
455 value="${module.docbase.dir}/api" />
456 <property name="module.javadocjar.name"
457 value="${module.name}-doc.jar" />
458 <property name="module.testjavadocjar.name"
459 value="${module.name}-test-doc.jar" />
460 <property name="module.testjavadoc.dir"
461 value="${module.docbase.dir}/testapi" />
462 <property name="module.pdfdoc.dir"
463 value="${module.docbase.dir}/pdf" />
464 <property name="module.doccheck.dir"
465 value="${module.docbase.dir}/doccheck" />
466 <property name="module.jar.name" value="${module.name}.jar" />
468 <!-- Replace the dash by a / to create a relative directory
469 from a module name -->
470 <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
473 <!-- ============================================================================
474 Initialize the environment for other tasks. Normally, every task which
475 does not depend on any other task should at least depend on init.
476 ============================================================================ -->
478 <target name="help" depends="import_header">
479 <antcall target="help-within-module"/>
480 <antcall target="help-outside-module"/>
483 <target name="help-within-module" depends="init_directory_properties" if="module.name">
484 <antcall target="help-impl"/>
487 <target name="help-outside-module" unless="module.name">
488 <antcall target="help-outside-module-2">
489 <param name="module.name" value="MODULE_NAME"/>
493 <target name="help-outside-module-2" depends="init_directory_properties">
494 <antcall target="help-impl"/>
498 <target name="help-impl">
503 deps: Download dependencies, this is necessary for using
504 any of the build targets.
505 clean-deps: Remove downloaded dependencies.
507 General build targets:
509 clean: Cleans up all build results (excluding the dist location).
510 compile: Compiles all java clasess. Target dir ${module.classes.dir}
511 jar: Creates a jar file. Target: ${module.jar.file}
512 dist: Makes the build results available for other modules Target: ${module.dist.dir}.
513 dist-lite: Similar to dist but only creates the jars for code and test code. Useful
514 during development because it takes much less time than the dist
516 clean-dist: Cleans up the dist directories.
520 test: Compile and run tests.
521 junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit)
522 reports: As junit-reports but also generates an emma test coverage
525 Note: By specifying -Dtest=TestCaseName on the ant command line,
526 only the specified testcase will be run.
528 Emma can also be executed manually:
530 emma: Overwrites the production classes by their instrumented versions.
531 emma-reports: Generates emma code coverage reports after running the
532 testcases with instrumented classes.
536 javadoc: Generates javadoc. Target: ${module.javadoc.dir}
537 doccheck: Checks documentation. Target: ${module.doccheck.dir}
541 checkstyle: Checks the style of the code.
542 format: Formats to the code in accordance with the checkstyle rules.
543 simian: Analyse similarities in the code.
547 For all targets below the database is configured using
548 hibernate.properties (hibernate.dialect property) and
549 the JDBC connection properties in database.properties.
551 The schemaexport and schemaupdate targets require the
552 setting of a property named hibernate.filelist. The value
553 of the property must be the fully qualified class name of
554 a concrete subclass of ConfigFileList which has a default
555 public constructor and defines the Hibernate mapping files that
558 schemaexport: Generate SQL code to create the required database structures.
560 startdb: Startup a lightweight database. The database
561 type to start is obtained from the currently
564 schemaupdate: Populate the database with a schema by running
565 Hibernate schemaupdate against the currently