Velocity templates are used to customize content of build notifications. Detailed information about velocity template can be accessed from Apache's web site. Two variables are defined to help inserting information related to QuickBuild. The first variable is build, which refers to current build object. From this variable, information such as build version, build status, configuration, build log, revision log can be accessed. JavaDoc of the build class will be the definitive guide on what methods or properties can be accessed from this variable. There are a lot of methods defined in this class, you should pay attention to those started with OGNL: prefix (In QuickBuild, all properties or methods for OGNL expressions can also be used to construct velocity templates). The second variable is system, which refers to current QuickBuild system. From this variable, information such as calendar, system url can be accessed. Again from the JavaDoc, you can get the full guide on what methods can be called on this variable.
Other files can be included in the template, as long as they are put
under <QuickBuild installation
directory>/templates
. For example, the default body template
for Email notifier contains just one line: #parse
("html_notification.vm"). This line includes and parses content
of file html_notification.vm
in
templates
sub directory of QuickBuild installation
directory.
To facilitate writing of your own notification templates, some typical variable references are listed below:
$build.version
$build.successful
$build.failed
$build.url
$build.buildLogUrl
$build.revisionLogUrl
$build.buildLogPath
$build.revisionLogPath
$build.configuration
$build.configuration.url
$build.configuration.logUrl
$build.configuration.logPath
$system.readFileAsHtml("$build.buildLogPath", ".*ERROR.*", 25)
$system.readFileAsHtml("$build.revisionLogPath")