Using RbUtils Ant Tasks

This page describes how to use the RbUtils Ant tasks. They have been tested using Ant 1.6.5.
These tasks are included in the RbUtils distribution and all share some common attributes.

The folowing tools have an Ant task: RbChecker and RbGenerator.


Tasks declaration

NOTE: see also the Use page.

To use the task in a build file, you will need the following taskdef declaration:

<taskdef resource="org/ktc/rbutils/rbutilsTasks.properties"
         classpath="/path/to/rbutils-all-0.13.jar"/>

Or, if you don't want to use the "all" jar, you will need the following taskdef declaration:

<taskdef resource="org/ktc/rbutils/rbutilsTasks.properties">
    <classpath>
        <pathelement location="/path/to/rbutils-0.13.jar"/>
        <pathelement location="/path/to/commons-lang.jar"/>
        <pathelement location="/path/to/commons-io.jar"/>
    </classpath>
<taskdef/>

Or, assuming that RbUtils is in the global classpath (not recommended), then you will need the following taskdef declaration:

<taskdef resource="org/ktc/rbutils/rbutilsTasks.properties"/>

Common Attributes of RbUtils Tasks

All tasks share the following attributes.

Parameters

The root directory.
If no fileset is specified, the root directory is also used for properties source files search.
This means that all files in this directory, with the specified extension, will be be processed.
See RbChecker or RbGenerator examples for more information.


Attribute Description Required
root The root directory used to resolved package name in the target directory or jar files. Yes
extension The extension of properties files to be considered during the properties source files search. This is only used if there are no nested filesets provided. No; defaults to "properties"
displayLocale The locale used by the loggers to display messages. No; defaults to ""
failOnErrors Specifies whether the build will break if errors occur. No; defaults to true
failureProperty The name of the property to set if errors occur. No
maxErrors The maximum number of errors that are tolerated before breaking the build or setting the failure property. No; defaults to "0".

Parameters specified as nested elements

The task supports the nested elements <fileset> and <logger>.

WARNING: files in the fileset must be in the root directory (this is needed for package name resolution). If not, Exceptions will occur.

The parameters for the <logger> element are the following. If no logger is specified, the task acts as with a plain text logger to standard output.


Attribute Description Required
type

The type of output to generate. The valid values are:

  • plain - specifies the plain text logger
  • xml - specifies the xml logger
Defaults to plain.

No
outputFile The file to write output to. Defaults to standard output with the plain text logger. Note, there is no way to explicitly specify standard output. Yes, if the type is xml.