Question & Answer
Question
How do you propagate build errors reported by an IBM Rational Application Developer (RAD) ANT build script to IBM Rational Team Concert (RTC)?
Cause
If you execute a Rational Application Developer ANT build script where build errors are reported, these errors are not shown in the Rational Team Concert Build Results view.
Answer
The set of steps below describes how to ensure that build errors reported by a Rational Application Developer ANT build script are also visible in the build results editor in Rational Team Concert.
The sample ANT script includes tasks from three sources: Rational Application Developer, Rational Team Concert Build Toolkit and Ant-Contrib. (See the Related information section for the download location of Ant-Contrib.)
The script uses the following Rational Application Developer tasks: workspaceBuild and projectImport.
The script uses the following Rational Team Concert tasks: startBuildActivity, completeBuildActivity and logPublisher.
The script uses the following Ant-Contrib tasks: if
, then
, else
.
Prerequisites:
- Install Rational Team Concert server 3.0.1.3
- Install Rational Team Concert Build Engine 3.0.1.3
- Install Rational Application Developer 8.0.4
- Install Rational Team Concert Client Extension for Eclipse IDE 3.0.1.3 in the same package group as Rational Application Developer. Note that if you are using a 64 bit Package Group for Rational Application Developer, you need to use at least Rational Team Concert 3.0.1.1 (See Related URL for more information).
- Start the Jazz Build Engine (JBE) with a command like the following:
C:\Program Files\IBM\TeamConcertBuild\buildsystem\buildengine\eclipse>jbe -vm "\Program Files\IBM\TeamConcert\jdk\bin\java" -repository https://hostname:port/ccm -userId buildUser -pass buildUser
- Configure a Build Engine in Rational Team Concert
Procedure:
Create a new Build Definition:
- Create a new Build
- Specify the ID
- Select Command Line / Jazz Build Engine
- Select Next
- Select Jazz Source Control
- Select Next (Do NOT select any Post Build Options)
- Select all default choices in the page called: Additional Configuration::
General
Schedule
Properties
- Select Finish
Customize the new Build Definition:
- Go to Properties
- Add a Build Property of type String with the following details:
Name:WORKSPACE
(This name is referenced insiderunAnt.bat
, and it refers to the RAD workspace to be created.)
Value:C:\temp\build
(You can change this to any temporary, empty directory.)
- Select the workspace from which to build in Jazz Source Control. This is an RTC Repository Workspace. The owner of the workspace must be the same as the user given on the Jazz Build Engine Command line. You can set the owner in the workspace editor.
- Enter
${WORKSPACE}
in the Load Directory. (This means that RTC will load the contents of the RTC Repository into the location selected to be the RAD Workspace).
- Select: Delete Directory before loading to ensure that you build on a new, empty RAD Workspace every time
- Specify the following details on the Command Line:
Command:C:\Program Files\IBM\SDP\bin\runAnt.bat
(This is a script contained in the RAD installation directory. Make sure that you select the appropriate path for your installation.)
Arguments:-buildfile "C:\BuildScripts\build.xml"
Properties File:C:\temp\build\properties.txt
(This is a useful file for debugging: it contains the properties set by JBE when launching the build.)
- Select: Add build properties to native environment
- Select: Override existing environment variables
- Create the sample Build Script
C:\BuildScripts\build.xml
:
|
Items to customize inside the script:
- The properties
userId
andpassword
should match the corresponding entries specified on the JBE command line.
- The property
runningLocation
indicates the location where you downloaded the jar file containing theif
task (Ant-Contrib). See Related information for further details.
- You need to specify as many
projectImport
tasks as projects in your RAD workspace. For each project, specify theprojectname
. You do not need to specify the project location since RTC copies the projects into the LoadDirectory, which is also used by RAD as the Workspace directory.
Launch the build:
Right click on the Build Definition in the Work Items perspective and select Request Build... > Submit
End of the sample output, if there are build errors:
[workspaceBuild] WorkspaceGetErrors: errors=4 Project=TestEJBProj
[workspaceBuild] WorkspaceGetErrors: errors=0 Project=TestEJBProjEAR
[workspaceBuild] DONE. (errorCount=4)
[completeBuildActivity] Not using a proxy to reach https://localhost:9443/ccm/
[completeBuildActivity] Completing build activity "_QUytavtdEeG0uMLMzkDYMw" for build result "20120910-0835".
[echo] The value of the property workspaceErrorCount is 4
[echo] ERROR: TODO cannot be resolved to a type
[echo] ERROR: Syntax error on token "-", ; expected
[echo] ERROR: generated cannot be resolved to a type
[echo] ERROR: Syntax error on token "stub", ; expected
[echo] Completing the build with ERROR state
BUILD SUCCESSFUL
BUILD SUCCESSFUL
Total time: 2 minutes 29 seconds
HeadlessWorkspaceSettings: RESTORED autoBuild=true maxFile=1048576
Note:
You see:
BUILD SUCCESSFUL
because the build script contains:
<workspaceBuild failonerror="FALSE" />
The parameter
failonerror=
"FALSE" is required. Otherwise the tasks after
workspaceBuild would not be executed in case of a build failure.You could un-comment the
<fail> task inside the
<else> task, which would produce the expected message
BUILD FAILED However, it would also add an exception from the
<if> task in the
workspace\.metadata\.logEnd of the sample output, if there are no build errors:
[workspaceBuild] WorkspaceGetErrors: errors=0 Project=TestEJBProjClient
[workspaceBuild] WorkspaceGetErrors: errors=0 Project=TestEJBProj
[workspaceBuild] WorkspaceGetErrors: errors=0 Project=TestEJBProjEAR
[workspaceBuild] DONE. (errorCount=0)
[completeBuildActivity] Not using a proxy to reachhttps://localhost:9443/ccm/
[completeBuildActivity] Completing build activity "_M97TuvtnEeG0uMLMzkDYMw" for build result "20120910-0946".
[echo] The value of the property workspaceErrorCount is 0
[echo]
[echo] Completing the build with OK state
BUILD SUCCESSFUL
BUILD SUCCESSFUL
Total time: 2 minutes 23 seconds
HeadlessWorkspaceSettings: RESTORED autoBuild=true maxFile=1048576
Related Information
Product Synonym
Rational Team Concert
Was this topic helpful?
Document Information
Modified date:
29 September 2018
UID
swg21610613