Getting started with Ant builds on the Jazz Build Engine

The purpose of this article is to go over using an Ant script in conjunction with the Jazz Build Engine (JBE). This article is a continuation of the article about creating an Ant script using the Rational Team Concert (RTC) Ant tasks for build. We will walk through the creation of a JBE build definition that will call the Ant script we had set up in the previous article. We will also execute the build and walk through the build result to see the various build result contributions.

To call our Ant build script, let’s setup a basic JBE Ant build process for the complex Ant script from the previous article. If you are skipping ahead, the Ant script can be found here. Before we start the build, notice that there are several properties used in the script that is not declared in the script. RTC Build adds some properties to every build request, those properties can be found in the help under Build properties. That is how we can refer to variables like repositoryAddress, buildResultUUID, etc., for the RTC Build Ant Tasks. To get started with the JBE, we need to create a JBE Build Engine. Set up a project area, open the Team Artifacts view, and go to the Builds -> Build Engine. Right click on the Build Engine and select the New Build Engine.. option. Enter an engine id that makes sense to you, like jbe. Select the Jazz Build Engine build engine type option and select Finish.

Create Jazz Build Engine dialog

After the engine is created, we need to create a JBE build definition to run our Ant script. Right click on the Builds menu item and select New Build Definition.. Enter an id that makes sense for the Build Definition like Ant JBE project build, then select the Ant – Jazz Build Engine build template option, and click Finish.

Create Jazz Build Definition dialog

Open up our new Build Definition, and select our newly created JBE engine as a supported build engine. Click the Ant participant tab at the bottom of the Build Definition, so we can define it. For the Build file textbox, enter the location of the example script from this article. The Build targets textbox is optional for us because we already defined the default target as publish. However, if we wished to define another entry point or series of entry points we could define them here. Next, since we will be using the RTC build Ant tasks, we will need to select the Include the Jazz build toolkit tasks on the Ant library path option. This assumes that the Build Toolkit is installed together with the JBE. If it was moved for any reason, you would need to explicitly state the new build toolkit location by using the Ant argument -lib <path to build toolkit location>. This can be entered in the Ant arguments textbox. Additional Ant arguments that may help you in debugging Ant problems are -v for verbose output, and -diagnostic, which will NOT run the build script but output various Ant configuration data at runtime. Once we have all the Build Definition Ant configuration information entered, start a build by clicking the upper right icon for Request Build.

Configuring JBE Ant build participant

The JBE is found in the buildtoolkit under <Build Toolkit dir>/buildsystem/buildengine/eclipse/jbe.exe. To start the engine we need to enter a command from the command line like so: jbe.exe -repository <ccm repository URL> -userId <user> -pass <password> -engineId <engine id>

The command will start the JBE and we should see something like:
2013-02-15 12:36:06 [Jazz build engine] Running build loop...
2013-02-15 12:36:06 [Jazz build engine] Waiting for request...

This will be followed by an entry that a user build has been picked up. This is the JBE connecting to our RTC instance, finding the request that we queued there, and running it. We can find the build results by double clicking on the Build Definition we created. The build will be running or completed if we saw the message in the JBE about the build being picked up. If we have configured the build correctly, it will have passed. Open the build result for the build we just ran. The build result should have a file download and a log file in the Contribution Summary. The log contribution will have the log from the JBE execution of the Ant file and the file download is the output from the Ant script that we contributed back to RTC via the artifactFilePublisher in the publish Ant target. We can also see the Build Activities that we created in the various targets. The activities will show when the activities were started and how long it took to run them.

Now that we have executed the Ant script from the JBE build definition, you can start editing the script and the build definition to customize it for you own project. For more resources on Ant, check the Ant home page at http://ant.apache.org/. For more examples of Ant and JBE check the wiki: https://jazz.net/wiki/bin/view/Main/AntBuild as well as the packaged examples in the build toolkit.


For more information:

About the author

Spencer Murata currently works in the RTC Level 3 Team in Littleton MA. He can be contacted at murata@us.ibm.com.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Feedback
Was this information helpful? Yes No 4 people rated this as helpful.