Chapter 13. Creating the Project Builder(s)

Table of Contents

Configuring Ant Builder.
Configuring Command Builder.
Configuring Maven Builder.
Configuring Maven2 Builder.
Configuring Rake Builder.

Builder(s) are responsible for executing a build for a particular schedule of the project.

To create Builder(s), click on Builders tab, and click on New icon in the upper right corner of the tab's frame. Builders editor tab will display.

Builders Editor Tab

Select the appropriate Builder type. The following Builders are available:

Ant Builder
Command Builder
Maven Builder
Maven2 Builder
Rake Builder

You can create as many builders as needed for different tasks for the given project. You will then select particular builders and/or post-builders for each schedule of this project as appropriate from the set of builders defined here.

Configuring Ant Builder.

Name

Provide a name to identify this builder, this name can be changed later.

Command to run Ant

Specify the command to run Ant (normally path to ant.bat or ant shell script). For example: /path/to/ant. String enclosed by ${...} will be interpreted as OGNL expression, and it will be evaluated before execution. Root object used for OGNL expression evaluation here is current Builder object.

[Note]Note

A single argument that includes spaces should be quoted in order not to be interpreted as multiple arguments.

[Note]Note

From available Ant command line options, you should not specify the option "-buildfile" and "-logfile", which will be used by Luntbuild. Other options are allowed.

You can modify the command to add Ant command line options and properties, for example -Ddebug=_debug.

Build script path

The path of the Ant build script. If this path is not an absolute path, it is assumed, that it is relative to the project work directory.

Build targets

Specify the target(s) to build. Use space to separate different targets (target name containing spaces should be quoted in order not to be interpreted as multiple targets). If not specified, the default target in the above Ant build file will be build. You can also use OGNL expressions (${...}) to pass variables as the target name. For example you can use ${build.schedule.name} to use different targets for different schedules. Root object used for OGNL expression evaluation here is current Builder object.

Build properties

Define build properties here to pass into the ant build script. For example:

buildVersion=${build.version}
scheduleName=${build.schedule.name}

You should set one variable per line. OGNL expression can be used to form the value provided it is enclosed by ${...}. Root object used for OGNL expression evaluation here is current Builder object.

Environment variables

Environment variables to set before running this builder. For example:

MYAPP_HOME=${build.schedule.workingDir}
SCHEDULE_NAME=${build.schedule.name}

You should specify one variable per line. OGNL expression can be inserted to form the value, provided they are enclosed by ${...}. Root object used for OGNL expression evaluation here is current Builder object.

Build success condition

The build success condition is an OGNL expression used to determine, if the build of the current project was successful (root object used for OGNL expression evaluation here is current Builder object). If left empty, the result==0 and logContainsLine("BUILD SUCCESSFUL") value is assumed. When this expression evaluates to true, the build is considered successful. Here are some examples to demonstrate format of this OGNL expression:

result==0, here "result" represents return code of ant execution of the build file.
logContainsLine("^ERROR.*"), the expression will be true if the build's build log contains a line that matches the regular expression pattern "^ERROR.*". Please see http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html for the format of the regular expressions.
The above expressions can be prefixed with a '!' character to inverse the value. For example, !logContainsLine("^ERROR.*") will be true if the build log does not contain a line that matches the specified pattern.
The above expressions can be joined into expression with "and", and "or". For example, the expression result==0 and !logContainsLine("^ERROR.*") will be true if Ant execution of the build returns 0, and the build log does not contain any line starting with "ERROR".