# ClearCase Source Control Integration

WebLogic Workshop integrates with the IBM Rational ClearCase. Information about ClearCase is available at http://www-306.ibm.com/software/rational/offerings/scm.html. This topic describes how to put your Workshop application under source control with ClearCase.

WebLogic workshop integrates with these ClearCase products: ClearCase, ClearCase MultiSite and ClearCase LT, versions V2003, V2002 and V4.2.

## Setting Up Source Control Integration with ClearCase

WebLogic Workshop supports integration with ClearCase for a Workshop application and all of its projects, or for an individual project with an application. In either case, all of the files of the Workshop application or project must be associated with a single ClearCase Version Object Base (VOB). This restriction also means that:

- The mapping between the files in a Workshop application or project and the ClearCase VOB must be defined by a single snapshot view.
- The root directory for the application or project must reside beneath the root directory for the ClearCase VOB. If the root directory for the application or project is in a subdirectory of the VOB root directory, then all of the parent directories must also exist in the VOB.

It's possible for a single Workshop application to contain multiple projects that are mapped to different VOBs and have separate associated views.

Note: We recommend that you create a snapshot view in ClearCase to map your Workshop project files to the ClearCase VOB. You may encounter unexpected behavior with Workshop if you are using a dynamic view.

To Add Your Workshop Application or Project to ClearCase

1. Make sure that you have a snapshot view that provides access to the VOB where your application or project files will reside. If you need help creating this view, see the ClearCase documentation or ask your system administrator.
2. Create a new Workshop application or project in a directory that is beneath the root directory for the VOB. If you are copying or moving an existing application or project, you should clean it before you add it to source control, so that build artifacts are not added along with source files. To clean an application, select the application name in the Application pane, right-click, and select Clean Application. To clean a project, select the project name in the Application pane, right-click, and select Clean <projectname>.
3. If you're adding an application to source control, select Tools-->Application Properties, then select the Source Control tab. If you're adding a project, select Tools-->Project Properties--><projectname>, then select the Source Control tab and clear the Use application's source control settings option.
4. Set the Source control module option to ClearCase.
5. Set the cleartool directory option to point to the location of the ClearCase cleartool utility. If you accepted the defaults on installation, the directory containing the cleartool utility should look something like C:\Program Files\Rational\ClearCase\bin. Note that you should include the path only, not the file name. The cleartool utility is the command-line utility that WebLogic Workshop uses to integrate with ClearCase.
6. Set the ClearCase Version option to your server version. Be sure to verify that you have specified the right version, as you may experience problems with ClearCase integration if the version is incorrect.
7. Set the ClearCase view type setting to snapshot, if you are using a snapshot view.
8. Set other options in the properties dialog as desired.
9. When you click OK, WebLogic Workshop will verify the location of the cleartool utility and will verify that the application or project's root directory is beneath the ClearCase VOB. If your view is a snapshot view, WebLogic Workshop will also prompt you to perform an update against the parent directory of the application or project root directory.

## Adding Files to ClearCase

After you've configured WebLogic Workshop to integrate with ClearCase, you can add the files in your application or project to ClearCase through the IDE. To add a file, select the file in the Application pane, right-click, and choose ClearCase-->Add or Add and Checkin.

There are some differences between versions of ClearCase in terms of how files and directories are added to source control. These differences are outlined in the following sections:

### ClearCase V2003

With ClearCase version V2003, when you add a file to source control, its parent directories are automatically added as elements and checked out. If you add the application or project root directory, the parent of this directory, which is not visible in the Workshop IDE, is automatically checked out. You must use an external ClearCase tool to check this directory back in.

If you execute the Add and Checkin command on a file, the parent directories of the file are automatically checked in.

If you execute the Add and Checkin command on a directory, you must check in the parent directories of that directory manually in order to commit the addition.

### ClearCase V2002 or Earlier

With ClearCase version V2002 or earlier, all parent directories must already exist in the VOB and must be checked out before you can add a file that resides in a subdirectory. You must check in all checked out parent directories to commit the operation.

### Using External ClearCase Tools

In some situations you will need to use external ClearCase tools, such as ClearCase Explorer or the cleartool utility, to perform certain operations on files in your application or project. These operations include:

- Adding the .work file to ClearCase or checking it in. However, once you've added the .work file to source control, WebLogic Workshop will prompt you to check it out if you make a change that affects the .work file.
- Adding, checking out, or checking in the parent directory of the root directory of the application or project. In version V2003 only, this directory will be automatically checked out when the root directory is added to ClearCase, but an external tool is required to check it back in.
- Checking in a file that is not the most recent version on the branch.

The ClearCase Find Checkouts utility may be useful in conjunction with WebLogic Workshop. This utility shows all checkouts in the view, including those that are not visible in WebLogic Workshop, like the parent directory of the root directory of the application or project.

## Checking Out Files

To check out a file from within WebLogic Workshop, right-click on the file in the Application pane and choose ClearCase-->Checkout.

If the file you are checking out is not the latest version in the VOB, you'll see a warning in the checkout dialog. At this point it's recommended that you dismiss the dialog and update the file before continuing. You can also choose to check the file out and merge your changes in with the head version in the VOB when you submit the file.

Note that you cannot check out a file that is writeable.

## Stopping ClearCase Commands

Once in awhile a ClearCase command may fail to finish executing. If this happens, you can halt the command by right-clicking in the ClearCase window and choosing Stop. Once you've enabled ClearCase integration, the ClearCase window is available by choosing View-->Windows-->ClearCase.

Warning: Use caution when halting executing ClearCase commands, as doing so can have unpredictable or undesirable results.

Related Topics

Integrating with Source Control Systems