Home

 

Creating a build engine and a build definition

In this section we describe how to configure the build engine in RAD v7.5. Subsequently we create a new build definition and associate it to this build engine.

In the Team Artifacts view, expand the Project Area node.

Right-click Builds Æ Build Engines, and select New Build Engine.

In the Build Engine editor, set the following values:

ID: default (if you change this value, you need to pass an optional argument engineID when you start jbe)
Team Area: ITSO RedBank Project Team
Save the Build Engine editor.

If the build engine is not currently running you will see a warning in the editor.

We are now ready to create a new build definition of type Command Line - Jazz Build Engine.

Expand the Project Area in the Team Artifacts view.

Right-click the Builds node, select New Build definition, and enter the following values (Figure | 9-37):

Team Area: ITSO RedBank Project Team
Select Create a new build.
Among the available build templates, select Command Line - Jazz Build Engine.
Click Next.

Figure 29-37 New build definition of type Command Line - Jazz Build Engine

Select Jazz Source Control. You do this when you want to load files from a repository workspace before the build starts.
Click Finish.

Now we have to provide a command based on the contents of the script:

C:\IBM\BuildUtility\eclipse\bin\runAnt.bat

The foregoing script uses some operating system environment variables, such as WORKSPACE. In the Build Definition editor you cannot access operating system environment variables, but you can set up properties. Property values can be defined in the Properties tab of the editor and can be referenced from any tabs using the syntax ${propertyName}. For clarity, because the term workspace is overloaded in this context, we will replace the WORKSPACE environment variable used in runAnt.bat with the BU_WORKSPACE property in the Build Definition editor.

To get started, try and save the Build Definition editor. You will see that there are three errors detected:

A command must be specified

A load directory must be specified

A repository workspace must be specified

If you click any of the errors, you are taken to the field of the editor that misses a required value.

Workspace: ITSO Redbank Project Build Workspace (this is the repository workspace owned by the build user with the latest sources to build)

Load directory: ${BU_WORKSPACE}

Command:
${JAVA_HOME}\java.exe -Dwtp.autotest.noninteractive=true 
-Dwas.runtime=${BASE_DIR}..\..\runtimes -cp ${BASE_DIR}\startup.jar 
org.eclipse.core.launcher.Main  -application com.ibm.etools.j2ee.ant.RunAnt

Remain in the Command Line tab of the Build Definition editor and enter Arguments as:

-data ${BU_WORKSPACE}  -buildfile ${BU_WORKSPACE}\AntScripts\BUBuild.xml

Switch to the Properties tab of the Build Definition editor and enter the following Property Name and Value pairs:

BASE_DIR: C:\IBM\BuildUtility\eclipse

Note that BASE_DIR is defined as the eclipse subfolder of the installation directory of the Application Developer Build Utility. You might have to change this value to match your installation of the build utility.

JAVA_HOME: ${BASE_DIR}\jdk\bin

BU_WORKSPACE: C:\builds

${BU_WORKSPACE} is used as value of the Team Concert load directory and as value of the Eclipse workspace used by the build utility.

The load directory is a temporary storage on the build server where the contents of the repository workspace owned by the build user will be copied when the build starts.

Because we pass the value of this variable as the -data argument to the build utility, the build utility will create an empty Eclipse workspace in that same directory. It will be the responsibility of the Ant build script to actually import the projects into the empty workspace. This is done by using the Ant task projectImport without any specified projectLocation as we have already seen in Creating the build file (BUbuild.xml).

Because we have previously shared the Ant script, it will be copied to the load directory, and we can therefore provide its location using -buildfile.

ibm.com/redbooks