# CVS Source Control Integration

WebLogic Workshop integrates with Concurrent Versions System (CVS), an open-source version control system. The CVS source, binaries, and documentation are available at http://www.cvshome.org. This topic describes how to set up and use CVS with a WebLogic Workshop application.

For more thorough information on CVS, you should consult the CVS documentation. A good resource for information on setting up a CVS repository and using CVS is The CVS Book, by Karl Fogel and Moshe Bar. It's available in various formats on the Internet under the GNU General Public License.

## Setting Up Source Control Integration with CVS

The first thing you need to do to put your WebLogic Workshop application under source control in CVS is to install CVS and set up the CVS repository. Here's a brief outline of the steps you need to follow to set up a repository on your local machine.

To Create a CVS Repository on Your Local Computer

1. Make sure that the directory in which you've installed CVS is listed on your system PATH.
2. Initialize the repository from the command line. The CVS init command creates the repository directory and the CVSROOT subdirectory and copies in the necessary CVS config files. For example, cvs -d /myrepos init creates a new repository myrepos at the root level.
3. Set the CVSROOT environment variable on your machine so that you don't need to specify the repository every time you refer to it from the command line. For example, SET CVSROOT=/myrepos.
4. Modify the cvswrappers configuration file to specify that CVS should automatically detect and add JAR files as binary files. Otherwise you will later need to modify each of these files individually so that they are flagged as binary.

Once your repository is set up, you can add a WebLogic Workshop application to it as described below.

The following instructions outline how to connect to an existing CVS repository on a remote server.

To Connect to a CVS Repository on a Remote Server

1. If you are using a remote CVS repository, you'll need a user name and password for that CVS server, and you'll need to know the server host name and the path to the CVSROOT. Get these from your system administrator.
2. Set the CVSROOT environment variable to the remote repository. In this case, you use the :pserver: method to specify a remote connection, and you specify your user name, the server host name, and the CVSROOT directory. For example, the command should look something like the following: SET CVSROOT=:pserver:guest@cvsserver.bea.com:/remoterepos.
3. Use the CVS login command to login to the remote server, and specify your password when prompted.

To Add a WebLogic Workshop Application to CVS

1. Create a new WebLogic Workshop application to add to source control. If you have an existing application, you should clean it before you add it to source control, so that build artifacts are not added along with source files. To clean your application, select the application name in the Application pane, right-click, and select Clean Application.
2. Exclude certain files in the application from the repository by adding .cvsignore configuration files to the appropriate directories:
   1. Create a .cvsignore file containing the line ".workshop" in the base directory for the application (that is, the directory containing the application .work file).
   2. Create a .cvsignore file in the META-INF directory containing the lines ".wlwLock" and "*.xml".
   3. Create a .cvsignore file in APP-INF/lib containing the line "*".
   4. Create a .cvsignore file in the WEB-INF directory for each web application containing the lines ".pageflow-struts-generated", "class", "lib", "*.tld", "*.tldx". If you have added your own tag libraries or JAR files, you won't want to exclude those; instead list the files to be excluded by name.
3. Import your Workshop application into the repository. From the command line, navigate to the directory where your application resides. The directory from which you want to perform the import is the base directory for the application, the directory containing the application's .work file. From that directory, call the CVS import command, specifying a name for the directory beneath the CVSROOT directory into which the files will be imported. For example, cvs import -m "import samples" SamplesApp vtag rtag imports everything in the current directory into a project directory named SamplesApp beneath the CVSROOT. The -m flag specifies a log message for the operation, and the vtag and rtag parameters provide placeholders for additional information. You can specify any string for these values.
4. Create a working directory for your CVS project. Create a new directory in the file system, then navigate to that directory and perform a cvs checkout to add the project files to the working directory. Specify the project directory that you named in the import command. For example, to populate the working directory using the SamplesApp project that was imported into the repository in the previous step, call cvs checkout SamplesApp from the command line within your new working directory.
5. You may want to rename your original project directory (the one from which you imported your application files) so that you don't confuse it with the working directory. In the working directory, CVS keeps track of which files have been modified, so that it can submit those to the respository. You can also delete the original project directory once you're sure that the import has been successful.
6. Open your Workshop application from the working directory. You may be prompted to update the libraries for any web application projects. These libraries don't need to be added to source control, but are necessary for your application to build properly.
7. The CVS import process may not import empty directories, so you may have to re-create them. For example, if the Schemas project was empty at the time of import, you may need to delete and re-create this project within your application.
8. In WebLogic Workshop, select Tools-->Application Properties, Source Control tab.
9. Specify CVS for the Source control module setting.
10. Specify the location of your repository for the CVSROOT setting. For example, you might specify /myrepos if you are using a local repository. If you have already set the CVSROOT environment variable, this setting shouldn't be necessary, but it doesn't hurt to include it.
11. The CVS file commands should now be available on each file in your application (excepting those you have excluded). Right-click the file name in the Application pane and choose CVS from the menu to see the available commands.

### Related Topics

Integrating with Source Control Systems