Skip to main content

Using IBM Rational Software Analyzer with IBM Rational Build Forge

Jill Ackerman (jeackerm@us.ibm.com), Technical writer, IBM
Jill Ackerman has worked as a technical writer for enterprise software companies in Austin, Texas for 15 years. She is currently happy to be working with the Rational Software Analyzer and Rational Build Forge teams at IBM.

Summary:  Using IBM® Rational® Build Forge™ to schedule, configure, and automate software analysis.

Date:  29 Apr 2008
Level:  Intermediate PDF:  A4 and Letter (40KB | 12 pages)Get Adobe® Reader®
Activity:  534 views

If you have IBM® Rational® Build Forge™, you can automate the process of configuring and scheduling an analysis, and you can integrate analysis as a part of your build or software development process.

Overview of automating analysis with Build Forge

To use Rational Build Forge to automate software analysis, you need to set up the required Build Forge objects:

  • An adaptor
  • An environment
  • A project

When you run an analysis as a Build Forge project, a link to the analysis report is created in the Build Forge job log. The analysis report is saved to the repository on the IBM® Rational® Software Analyzer server. Analysis reports provide a record history that can be used for many purposes, including decision support, quality control, and compliance. In addition to the analysis report record, the Build Forge job log also provides an analysis report history. In Build Forge, you can schedule analysis based on your requirements. For example, you might synchronize analysis with release builds only, run an analysis as part of every build, or run analysis during off hours if you have a large code base.

Steps to set up the required objects

To set up the required objects, you will complete these tasks, which the subsections that follow explain further:

  1. Choose an analysis adaptor template
  2. Specify parameter values for the analysis adaptor template
  3. Create a Build Forge user for Rational Software Analyzer
  4. Set up a Build Forge server
  5. Copy analysis adaptor templates to Build Forge
  6. Set up notification for the analysis adaptor

Choose an analysis adaptor template

To run an analysis, Build Forge uses an adaptor template. The template includes the application parameters required to configure and run the analysis command. In the enterprise edition of Rational Software Analyzer, the adaptor templates are located in the interface directory under the root installation directory. Table 1 describes the analysis adaptor templates provided with Rational Software Analyzer.


Table 1. Analysis adaptor templates
Adaptor template nameDescription
RSAR_UserDirScript.xml Use this adaptor to run an analysis using the rule set specified by the RULEFILE parameter against the list of directories returned by a user script that you create.

Use the DIR_SCRIPT parameter to specify the fully-qualified path to the user script. The user script must return a set of one or more directories in a line-separated format.

Using a script allows you to change the source directories analyzed without editing the adaptor configuration in Build Forge. Simply edit the shell script to change the list of source directories that you want to analyze.

The RULEFILE and DIR_SCRIPT parameters are Build Forge environment variables. See the next section, "Specify parameter values for the analysis adaptor template."

RSAR_StaticDirs.xml Use this adaptor to run an analysis using the rule set specified by the RULEFILE parameter against a static set of source directories that you provide.

Use the DIRECTORIES parameter to specify a comma-separated directory list. To add or delete a directory, you must edit the adaptor configuration in Build Forge.

The RULEFILE and DIRECTORIES parameters are Build Forge environment variables. See the next section, "Specify parameter values for the analysis adaptor template."


Specify parameter values for the analysis adaptor template

The adaptor templates used by Build Forge require specific environment and application values to run the analysis command. Before you set up Build Forge objects, record the parameter values that you need to define for your analysis adaptor template. In Build Forge, you supply parameter values when you create an environment object. Table 2 describes the parameters for the analysis command.

Note:
Do not edit analysis parameters in the adaptor template XML files.


Table 2. Parameters for the analysis command
Parameter nameDescription
ECLIPSE Specify the fully-qualified path to the Eclipse™ executable file. If you install Eclipse with Rational Software Analyzer, the Eclipse executable file is in the Rational Software Analyzer installation root directory.
CATALINA_HOME Specify the fully qualified path to the Apache Tomcat server that is installed with Rational Software Analyzer. The default location for the Tomcat directory is under the Rational Software Analyzer root installation directory.
RULEFILE Specify the fully qualified path to the rule file (<rule>.dat) that contains the analysis rules to run against the source files.

The rule file must be created in the UI.

Select rules on the Rules tab, then save and export rules to a <rule>.dat file. The <rule>.dat file must be accessible from the enterprise edition computer that runs the analysis command.

PROJECTNAME Specify a project name for analysis reports. On the Rational Software Analyzer Web server, reports are grouped by project name.

Each time an analysis runs, the analysis report is saved to the repository, and a link to the new analysis report is added under the project name.

Individual reports are named using a fixed date-time format: YYYYDDMMHHMMSS.

Note: The PROJECTNAME is a group name for analysis reports; it is not related to the Build Forge project name or the Eclipse project name.

REPORTDIR The location of the report repository where the HTML analysis report is saved and accessed.

This directory is fixed; if you change it, you cannot use the URL link in the Build Forge job log to access the report.

%CATALINA_HOME%\webapps\ROOT\rsar\reports

DIR_SCRIPT Specify the fully qualified path to the user script that returns one or more directories in a line-separated format. Note: The DIR_SCRIPT parameter is required only if you use the RSAR_UserDirScript.xml adaptor template.

The user script can be any type of shell script that can be processed by the operating system that runs the analysis command. For example, a Perl script, Linux® script, or a Microsoft® Windows® batch file. The enterprise edition of Rational Software Analyzer runs the analysis command line.

For Java™ projects, the directories returned by the user script must be fully qualified and must include the top-level directory that contains the source code and class files for all of the packages that you want to analyze. Note: To run the analysis, the Build Forge server auth login must have access to source files.

DIRECTORIES> Specify a comma-separated list of source code directories to be analyzed. Note: The DIRECTORIES parameter is required only if you use the RSAR_StaticDirs.xml adaptor template.

For Java projects, you must specify the top-level directory that contains all of the source code and class files for all of the packages that you want to analyze.

Note: To run the analysis, the Build Forge server auth login must have access to source files.

LAST_RUN_FORMAT Defines the format for the date and time. The default format is YYYYMMDDHHMMSS.
LAST_RUN The date and time of the last successful run of the analysis adaptor.

The default value for LAST_RUN is set to a date (20071202100000) that is known to be earlier than the current date to enable the analysis adaptor to run the first time and to populate the initial LAST_RUN value.

RSA_SERVER Specify the name of the Build Forge server object that represents the enterprise edition computer that runs the analysis command.

Create a Build Forge user for Rational Software Analyzer

To log on to the Management Console and create Build Forge objects, the Rational Software Analyzer user must have a Build Forge user name.

In Build Forge, create a user name for the Rational Software Analyzer user (Administration > Users). The user name that you create must have permission to run projects and to edit and create these Build Forge objects:

  • A server resource for the Rational Software Analyzer server
  • A server auth that the Management Console can use to log on to the Rational Software Analyzer server
  • An adaptor for the analysis adaptor template
  • A project to execute the adaptor and the analysis
  • An environment to define the parameter values for the analysis command

In Build Forge, you grant permissions by adding users to access groups.

Notes:

  • If you want to set up e-mail notification for the adaptor step or project, the user name that you create should be assigned an e-mail address that is configured for your SMTP server. For details, see the section about setting up notification for the analysis adaptor, which follows.
  • The login name that you define in the Build Forge server auth must be able to access the source files to run the analysis.

Set up a Build Forge server

A Build Forge server is a worker machine that runs commands. To enable Build Forge to run the analysis command, you create a Build Forge server object that describes the enterprise edition computer by completing the following tasks to set up a Build Forge server object (for detailed instructions, see the Build Forge documentation):

  1. Install the Build Forge agent on the computer where the enterprise edition is installed. Using the Build Forge installation media or the downloaded image, locate and install the agent executable file for your operating system. For example, on Windows: win-bfagent-version.exe. For help completing this task, see the Build Forge installation guide.
  2. In Build Forge, create a server object for the enterprise edition computer that runs the analysis command. In the Management Console, select Servers and enter information to create the object.
  3. In Build Forge, create a server auth with credentials that the Management Console can use to log on to the enterprise edition computer. In the Management Console, select Servers > Server Auth and enter information to create the object.
  4. In Build Forge, test the connection to the enterprise edition computer to verify that the login name and password that you specified for the server auth work. Complete the following steps:
    1. In the Management Console, select Servers and select the server object you created.
    2. Click Test Connection.
    3. In the Test Results, verify that the Management Console can connect to the enterprise edition computer with the server auth credentials.

Copy analysis adaptor templates to Build Forge

To use an adaptor template in Build Forge, the template must be copied to the Build Forge interface directory and then reset to be saved to the Build Forge database. Complete the following tasks to copy and reset the analysis adaptor templates (for detailed instructions, see the Build Forge documentation):

  1. From the enterprise edition computer, locate the adaptor templates in the interface directory. The interface directory is located under the Rational Software Analyzer root installation directory.
  2. Copy the adaptor templates to the Build Forge Management Console interface directory. The interface directory is located under the Build Forge root installation directory.
  3. In Build Forge, reset adaptor templates to copy templates to the Build Forge database by completing this procedure:
    1. In the Management Console, select Administration > System.
    2. In the list, select Reset Interface Templates and select Yes.

Create Build Forge objects for the analysis

The analysis adaptor template must be associated with a Build Forge adaptor, environment, and project. When the Build Forge project runs, the adaptor executes the code in the analysis adaptor template. Complete the following tasks to create the Build Forge objects needed run the command-line analysis (see the Build Forge documentation for detailed instructions):

  1. In Build Forge, create a Build Forge adaptor. An adaptor is an instance of an adaptor template. When you create an adaptor, you assign it a unique name and associate it with a template.
    1. In the Management Console, select Projects > Adaptors.
    2. Click Add Adaptor.
    3. Provide an adaptor name and the information to create the adaptor.
  2. In Build Forge, create a Build Forge environment. The environment contains parameters needed to run the analysis.
    1. In the Management Console, select Projects > Environments.
    2. Click Add Environment.
    3. Provide an environment name and parameter names and values to create the environment. For help with parameter values, see the parameter descriptions in the section titled Specify parameter values for the analysis adaptor template.
  3. In Build Forge, create a project for the adaptor. If you are adding the adaptor to an existing project, skip this task.
    1. In the Management Console, select Projects > Add Projects.
    2. Provide a project name and the information to create the Build Forge project.
  4. In Build Forge, add the adaptor to the project as a step, and select Environment as the environment for the step.
    1. In the Management Console, select Projects, and then select the project name and click Add Step.
    2. At Command, enter the .source adaptor dot command and the adaptor name. (If the name contains spaces, enclose the adaptor name in quotation marks.)
    3. At Environment, select the environment for the analysis adaptor.
  5. In Build Forge, run the project to test the integration of Build Forge and Rational Software Analyzer.
    1. View the Build Forge job log (BOM report).
    2. Select the URL report link to verify that it links to the analysis report.

Set up notification for the analysis adaptor

In Build Forge, you can set up notification so that a user is notified when the project or step for the analysis succeeds or fails. Complete the following tasks to set up notification for the adaptor step in Build Forge. For detailed instructions, refer to the Build Forge documentation.

  1. In Build Forge, create a notification access group and add the user name for the Rational Software Analyzer user to the access group. The user name that you create should be assigned an e-mail address that is configured for your SMTP server.
  2. In Build Forge, open the project and locate the adaptor step that runs the analysis command.
    1. In the Management Console, select Projects.
    2. In the list of steps, select the adaptor step. Step information displays in the Details tab.
  3. In Build Forge, run the project to verify that the Rational Software Analyzer user receives an e-mail notification of step success or failure.
    1. In the Management Console, select Projects.
    2. Locate the analysis project, and click the green Quick Start icon.

Integration scenarios for Rational Build Forge and Rational Software Analyzer

Scenarios describe how you might implement Rational Software Analyzer in your environment.

Scenario 1. Rational Software Analyzer Enterprise Edition, Developer Edition, and Rational Build Forge

In this scenario, developers run analysis rules to find and fix problems in their component code and the development manager runs a standard rule set on the application code base using Build Forge.

With Rational Software Analyzer in their Eclipse workbench, developers run analysis on their component code from their desktop throughout the week and iteratively fix problems found in analysis results. Developers check in component code to source control daily for the nightly build.

At the end of the week, the development manager runs an integration build for the application. If the integration build passes system test, the build can be deployed and released to customers.

The development manager uses the enterprise edition of Rational Software Analyzer to create a standard rule set for software quality that includes analysis rules to assess code quality, complexity, and structure. To run the standard analysis rule set, the development manager uses Build Forge to automate the steps to configure, schedule, and run software analysis.

In Build Forge, the development manager adds the standard analysis rule set to the Build Forge projects that manage the daily and the weekly integration builds. To do this, the manager completes these tasks:

  1. Creates an analysis adaptor that points to the source directories for the application and references the standard application rule set.
  2. Adds the adaptor as separate project step to the Build Forge projects that run the nightly build and weekly build.
  3. Schedules the projects to run daily and weekly.

Running the standard rule set each night allows analysis reports to be reviewed several times before the weekly integration build gets run and packaged for release distribution. A link to the analysis report from the repository on the Rational Software Analyzer Web server is sent to all project stakeholders and demonstrates that the application code meets quality benchmarks.

To provide a link to the analysis report for the daily builds to the test manager, the development manager creates a Build Forge user name for the test manager and adds the user name to an e-mail notification group in Build Forge.

Scenario 2. Rational Software Analyzer Enterprise Edition, Developer Edition, and Rational Build Forge

In this scenario, developers run analysis rules to find and fix problems in their component code. The development team lead optionally initiates a code review analysis weekly; and the development manager runs a standard analysis rule set monthly.

With Rational Software Analyzer in their Eclipse workbenches, developers run analysis on their component code throughout the week and iteratively fix problems found in analysis results. Developers check in component code to source control daily, and the development lead runs a weekly component integration build that can be packaged and released to customers if a the build includes required fix.

The development lead has the option to run a code review analysis as part of the weekly integration build. Using the Build Forge perspective in Eclipse, the development lead starts the project to run the weekly build. By default, the build runs the analysis. To skip the analysis, the development lead deselects the analysis adaptor step before starting the project.

Monthly, customers have the option to download and install the latest application code fixes and feature enhancements. Before building, packaging, and releasing the application code every month, the development manager runs a standard analysis rule set to measure code compliance with quality benchmarks. To automate the build by using Build Forge, the development manager completes these tasks to add the standard analysis rule set to the Build Forge project that manages the monthly release build:

  1. Creates an analysis adaptor that points to the source directories for the application and references the standard application rule set.
  2. Adds the adaptor as separate project step to the Build Forge projects that run the monthly release build.

Resources

Learn

Get products and technologies

  • Find more resources for build and release engineers and managers in the Build Forge area of the developerWorks Rational zone, including articles and whitepapers, links to training, discussion forums, product documentation and support.

  • Download trial versions of IBM Rational software.

  • Download these IBM product evaluation versions and get your hands on application development tools and middleware products from DB2®, Lotus®, Tivoli®, and WebSphere®.

Discuss

About the author

Jill Ackerman has worked as a technical writer for enterprise software companies in Austin, Texas for 15 years. She is currently happy to be working with the Rational Software Analyzer and Rational Build Forge teams at IBM.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=302727
ArticleTitle=Using IBM Rational Software Analyzer with IBM Rational Build Forge
publish-date=04292008
author1-email=jeackerm@us.ibm.com
author1-email-cc=rhalden@us.ibm.com

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Rate a product. Write a review.

Special offers