CSE132 CVS with Eclipse Tutorial

Follow these instruction to setup a CVS repository on your group account and have Eclipse use that repository for your 132 labs.  The first part will help you setup the CVS repository, the directory where CVS will store and manage the different versions of your source files. Do not create the CVS repository in your personal CEC account, or your partner won't have access to it. Use the group account that will be given to you in lab section.  The second part will help you create a new project with Eclipse and commit it to the repository.  The third part explains how to check out a project from CVS with Eclipse and the fourth part will teach you how to use Eclipse's CVS features. The second and third parts should be done within your individual CEC account, from which you will access your CVS repository within Eclipse using the group login and password.


Part 1 - Adding a project to the repository
   
-to be done once by 1 group member

  1. Open Eclipse from your main CEC account (not the group account).
  2. Select File->New->Project and from the New Project window select Java Project and click Next.
  3. Give you project a name and make sure that the JDK Compliance level is set to 5.0.  If it is not, you can either configure the workspace default or use a project specific compliance.  When you are ready, click Finish.
  4. New Eclipse Project
  5. Now that you have a project, we need to tell Eclipse to share it with CVS.
  6. Right-click on the project you just created and select Team->Share Project...
  7. Fill in the host, repository path, user, password, and connection type fields with the appropriate information (see screenshot below).
  8. Host should be grid.cec.wustl.edu and repository path should be
    /home/cec/project/sp2008_cvs/cse132/cse132xxx
    
    where the xxx is replaced by your group ID in lower case. (If you don't already have it, your group ID will be given to you in lab section.)

    Each of you will access CEC using your usual CEC login and password

    Make sure that you use extssh as the connection type.

  9. When you have setup the required fields, click Next.
  10. Share Project

  11. The next window will prompt you for a module name, you should just "Use project name as module name" and click Next.
  12. The next window will allow to you choose which resources you want to commit.  The defaults are fine in almost all cases so go ahead and leave "Launch the Commit wizard" checked and click Finish.
  13. You are now presented with the Commit Files window.  Whenever you commit files to CVS you should always enter a comment about the changes you have made to your code so it is easy for you and your partner to examine any changes that you have made to the project.  Click Finsh when you have entered an initial comment.  Your project is now committed to the CVS repository.
Commit Wizard

NOTE: When synchronizing, if you see the files .classpath or .project appear in the list of files to be synchronized (either during a commit or update), you should right click on them in the CVS dialog box and add them to cvsignore. (You can also add .cvsignore to cvsignore). This will prevent your partner's classpath or the CEC classpath from overwriting yours (which may be different from the one on your home machine). For example, you have a C: drive at home, but on CEC the java package is on the P: drive.

Part 2 - Checking out a project from CVS with Eclipse
   
-to be done by the group member that did not perform part 2 of this guide

  1. Start Eclipse within your main CEC account (not the group account)
  2. Select File->New->Project...
  3. Select CVS->Checkout Projects from CVS and click Next.
  4. If you are prompted to select an existing repository location, select "add a new location".  If you are not prompted, skip this step.
  5. Fill in the Host, Repository Path, User, and Password the same as in part 2 above.  When finished, click Next.
  6. You will now see the "Select Module" window as seen below.  Select to "use an existing module," and select your project.  When you have your project selected, click Finish.
  7. You have just checked out the project and are ready for programming.
Select Module


Part 3 - Using CVS with Eclipse

Now that you have created a project in CVS and have it checked out with Eclipse you can start coding.

Synchronizing:Before you start working you should always make sure you check if another team member has checked in changes so you can get the latest version of your source code.

  1. Right-click on your project in the package explorer and select Team->synchronize
  2. If you are asked if you want to switch to the "synchronizing perspective", click "yes."
Sometimes multiple people will be working on a project from different locations at the same time.  If this situation occurs and someone changes the repository version before you commit there could be conflicts.  If this happens you will be shown a "diff" (a comparison between 2 versions of a file) showing the differences between your version and the repository version.  Eclipse makes it very easy to choose which version you would like to commit.  If you aren't sure whether to keep your code or your partners you can always cancel the commit and discuss the issues with your partner before committing.  Don't worry if you make a mistake or commit the wrong code because with CVS you can always go back to a previous version. More functionality is available in the Eclipse "Synchronizing" perspective, accessible by right clicking on the project in the package explorer and choosing Team->Synchronize from the menu.

Ask a TA if you have any questions.



Written by Ryan Johns