Thursday, August 7, 2008

Basics of Subclipse when starting a new project

Subclipse is a plugin for Eclipse that adds a GUI in Eclipse to perform the basic functions of Subversion (like CVS or Visual SourceSafe (VSS)). Basically if you want to use Subversion while in Eclipse, Subeclipse is the tool for you.

This entry assumes that you have a Subversion repository already setup. It does NOT assume your project is in Subversion though. It does assume you already have a project in Eclipse though. In my examples, the name of my Eclipse project is called MyApp. Below are some basic things you should know where to find, but does not really get into Subversion features and how to use them. This entry assumes you know what Merge, Update, Commit, etc are used for, and how to use the other Subversion version control concepts. By no means is this a comprehensive look at all the features. It is really a view of things I use often or can't remember when I do them when I get a new project or start a new project. :)

Adding your project to Subversion.

Make sure your project is actually open (not closed), otherwise the Share Project... menu item will be disabled.

While in Eclipse, Go to the Package Explorer and right-click on MyApp (or whatever your project is called). Go to Team | Share Project...

When prompted select SVN as the repository type.

When prompted select your existing repository location, or create a new one if you don't have one already.

When prompted, use a custom path and append /MyApp/trunk to the path instead of just the default of /MyApp

Enter a comment like Initial import if it is not already specified.

When prompted select the files you want to add to source control. This should exclude any files that are specific to other version control systems such as VSS or CVS.

I would also highly recommend creating three remote folders (branches, tags, and trunk) under the project you just created in SVN. To do this do the following:

Go to the SVN Repository View (you can add it by going to the Window | Show View | SVN Repository menu item if it is not already visible.

Right-click on MyApp project in the SVN Repository View and choose New | new remote folder.

Enter branches

Then do the same for the other one tags

When you are done you will have a hierarchy like the following or something similar if you did not put yoru project at the root of the repository.

- svn://mySubversionServer/MyRepository/MyApp ---- branch ---- tags ---- trunk

Using Subversion operations on a file

Subclipse does a very nice job of integrating Subversion into the Eclipse IDE. To perform operations of a file simply do the following.

In the Package Explorer right click on the file you want to work with.

Go to Team and then choose the operation you want to use. This includes things like Merge, Commit, Show History, get the latest using Update, and a few other features as well.

Useful Perspectives

Subclipse includes some useful perspectives that may not be visible to start with. You can find them by going to Window menu Open Perspective Other...

This will show a window with a list of perspectives.

Click the SVN Repository Exploring and click OK. It is good to see all the projects in the repository or have direct access to the Repository.

Do the same for Team Synchronizing. Team Synchronization has the Synchronize view in it.

If you don't see them, click the Show all button in the Open Perspective window. There are also two other menu items that are of use when you right-click a file. They are the Compare With and Replace With menu items.

Adding a project from Subversion

This handy if you have a new machine, re-installed Eclipse, or just adding a project to Eclipse workspace that someone else put in Subversion and you need to work on now. To do this, do the folowing.

File menu New Other SVN folder Checkout Projects from SVN.

Walk through the wizard until it is finished.

If you want more information on Subversion operations, and installing subclipse see the link below.

http://www-128.ibm.com/developerworks/opensource/library/os-ecl-subversion/

1 comment:

Sqiar BI said...

Business intelligence analyst
SQIAR (http://www.sqiar.com/services/bi-strategy/) is a leading Business Intelligence company.Sqiar Provide business intelligence Services Which help the company to present Information in Meaningful form.