If you are using UCM, the process is similar but requires additional steps to create UCM objects. In addition, I will demonstrate how some of the more powerful capabilities of UCM work, such as baselines and composite components, to show you how they can be used in practice.
Create a UCM Project VOB
First, create a UCM project VOB (PVOB). A PVOB is not intended to hold any real data, such as source code. Instead, it is a specific repository for holding UCM metadata, such as projects, streams, and activities. Usually, one PVOB is shared across many teams; however, there is no reason that there can't be more than one of them if teams are isolated and have no reason to share code or changes. A PVOB might already have been created for you. However, for the sake of completeness, I will describe the process required to create it here; the command to do this is shown in Listing 3.5.
Listing 3.5. Creating a UCM Project VOB
This creates a PVOB called RatlBankProjects. There is no need to mount the UCM PVOB because it will not be accessed directly.
Create a Build Tools VOB
Next, create a Base ClearCase VOB (which will later be turned into UCM components) and a temporary Base ClearCase view. This can be achieved using the commands shown in Listing 3.6.
Listing 3.6. Creating a UCM JavaTools VOB
The reason that a Base ClearCase view is created is that a view context is required to execute some of the following cleartool UCM commands.
Create the Build Tools Components
Next, you should turn the Base ClearCase VOB into a UCM VOB so that it can contain the build tools components. This can be achieved using the commands shown in Listing 3.7.
Listing 3.7. Creating UCM JavaTools Components
This creates the following components:
This list of components is not prescriptive; you might like to create more or fewer components.
Alternatively, you can start the ClearCase Project Explorer GUI, right-click the Components folder, and select New, Component in a VOB. This brings up the dialog box shown in Figure 3.3, in which you can enter the details about the component to be created.
Figure 3.3. Creating a UCM component in the UCM Project Explorer
Create a Build Tools UCM Project
Now that the components have been created, the next stage is to create a UCM project and stream for accessing their data. This can be achieved using the commands shown in Listing 3.8.
Listing 3.8. Creating a UCM JavaTools Project and Stream
The first cleartool command creates a UCM project called JavaTools_Proj, specifying that it will be able to modify all the components created previously. It also specifies that the project is created in the RootFolder. The RootFolder is just a reference to a top-level virtual directory; if you want to, you can create folders to contain collections of related projects. The second command changes the project's baseline naming template, specifying that the format for each baseline will be of the form COMPONENT_BASENAME. You specify the basename when you create a new baseline. For example, if you create a new baseline in the ANT component by specifying a basename of 01_INT, the baseline ANT_01_INT is created. Baseline naming templates are a good way of automating and ensuring baselining consistency. Finally, the third command creates an integration stream for this project called JavaTools_Int.
Alternatively, you can use the ClearCase Project Explorer GUI, right-click the Project VOB folder, and select New, Project. This brings up the New Project wizard, as shown in Figure 3.4, which guides you through the process of creating a new project.
Figure 3.4. Creating a UCM project in the UCM Project Explorer
Create a Build Tools View
The next stage is to create a view onto the integration stream. This can be achieved using the commands shown in Listing 3.9.
Listing 3.9. Creating a UCM JavaTools View
The final rebase command is required to make sure that the view that has just been created is based on an appropriate baseline of all the components. Although no elements have been imported so far and this baseline is not that interesting, it is still required.
Alternatively, you can use the ClearCase Project Explorer GUI to join a project by right-clicking the project and selecting Join. This brings up the Join Project wizard, as shown in Figure 3.5, which guides you through the process of creating a new view onto the integration stream, as well as a new development stream and view if required.
Figure 3.5. Joining a project in the UCM Project Explorer
Import the Build Tools
The build tools view can now be used to import the build tools and add them to version control. Chapters 4 and 6 discuss how to compile and install Ant and CruiseControl; however, the process is the same irrespective of the tool being imported. You can either navigate to the relevant JavaTools component directory and copy the files in, or, if there is a significant amount of data to import, you can use the ClearCase clearfsimport command instead. For example, if you wanted to import a version of the JDK into the JavaTools VOB, if the JDK was currently located on the file system at C:\j2sdk_1.4.12, you could use the following commands to import it into the VOB:
>cd C:\Views\javatools_int\JavaTools\j2sdk >cleartool mkactivity "Initial Import" >clearfsimport -recurse C:\j2sdk_1.4.12\* .
This imports and version-controls every file under C:\j2sdk_1.4.12 into the JavaTools j2sdk component directory. Note that before you execute the import process, with UCM you need to specify that activity under which ClearCase check-ins should be associated. In this case it is an activity called Initial Import. This also assumes that the integration with ClearQuest has not yet been enabled for this project. If it has, the activity needs to be created from ClearQuest instead.
Baseline the Build Tools
After you have imported all the elements you require, you can finally place a baseline across them. At this stage you also can create the dependency from the composite baseline component to the other components. This can be achieved using the commands shown in Listing 3.10.
Listing 3.10. Creating a UCM JavaTools Baseline
In this example, a composite baseline JAVATOOLS_BL_01 is created, as well as baselines in any component that has been changed, such as the J2SDK component.
Alternatively, you can use the ClearCase Project Explorer GUI to edit the baseline dependencies, right-click the project integration stream, and select Edit Baseline Dependencies. This brings up the window shown in Figure 3.6, which allows you to drag and drop components to create the baseline hierarchy you require.
Figure 3.6. Creating baseline dependencies in the UCM Project Explorer
Once you have specified the dependencies, you are asked the name of the new baseline to be created. You would simply specify a basename of 01, as shown in Listing 3.10.
Make the Build Tools Available to Your Users
Once the JavaTools structure has been created and baselined, it can be made available to other projects. This can be achieved by adding the JAVATOOLS_BL components to any UCM project that is created, ensuring that the correct baseline is recommended. This will subsequently pull in the baselines for the other components. For example, Figure 3.7 illustrates the configuration of a new UCM project created using the New Project wizard.
Figure 3.7. Creating a new project configuration using the UCM Project Explorer
To prevent users from making any changes to the JavaTools structure, you should make the components read-only in the UCM project.
Clean up the Temporary View
Because a temporary view was created to set up the UCM JavaTools structure, it is good practice to tidy up this view. This can be achieved using the following command:
>cleartool rmview -f C:\Views\temp_view
Note that if you still have any command prompts or Windows Explorer sitting inside this directory, you need to close them down or navigate outside this directory first.