|
Using Toroise SVN and Eclipse
Russell Bateman
last update: 26 January 2010
|
This article explains how to set up and use TortoiseSVN, an interface to
Subversion on Windows. Ultimately, it's not a formal application run with
its own interface, but a plug-in that sensitizes Windows File Explorer to
Subversion control of files and directories in chosen subsets of the
Windows filesystem.
TortoiseSVN is a solution only for Windows. To employ Subversion for an
Eclipse project on Linux or Macintosh, you will need to find a different
approach. (See
Subversive—Subversion Team Provider for Eclipse.) This
will be the topic of another page of notes another time. There are still
some relevant comments here for Linux users (see notes
below.)
We also cover setting up and using Subversion inside of Eclipse.
Table of Contents
- How to set up and use TortoiseSVN
- Setting up Subclipse
- Using Eclipse Team on projects
- Useful links
How to set up and use TortoiseSVN
- Download TortoiseSVN and install from
http://tortoisesvn.net/download/
-
- Create the top-level directory of your managed filesystem.
-
- Here is an illustration of TortoiseSVN functionality as it appears in
the File Explorer—just right-click in open space or on a file or
directory. You will get different functionality depending on the context.
-
- Check out the repository corresponding to the subfolder open by
choosing SVN Checkout.... Then, fill in the URL of
repository field and confirm the other information in the
Checkout dialog.
-
- Enter username and password, click the box to make TortoiseSVN remember
your password if you like (otherwise you have to authenticate each and
every action), and then find something to do while your files and
directories are downloaded.
-
- For additional help using TortoiseSVN from the Windows File Explorer,
please consult the links at the top of the left-hand navigational thumb
found at About TortoiseSVN.
-
- If you want integration with the Eclipse IDE, refer to the section
below on this topic.
Setting up Subclipse...
To consume repository files through Eclipse (instead of going to Windows File
Explorer), you must set up the Subclipse plug-in software. This tutorial was
done on Eclipse Galileo.
I've long worked on Linux, and have used
Polarion Subversive (and not Subclipse) there.
It will be a while before I get to writing about using Subclipse on Linux (and
I'll only do that if there's something to say).
- Pull down menu
Help -> Install New Software...
-
- Click on the Add... button. Name this site (non-crucial)
"Subclipse" for example. Type in the URL. You can go to
subclipse.tigris.org and see
what the latest is. I used update_1.6.x, the latest for Galileo as
of this date of writing. Click OK.
-
- In the principal content region of the Install dialog, there
will be three projects. Select each one by checking their boxes. Then
click Next.
-
- Review and accept the licenses.
-
- Click Finish.
-
- The plug-ins will be installed. Then you must restart Eclipse.
-
- To ascertain if the software installation was successful and is useful,
right-click in the Eclipse Package Explorer on a package or file
and choose Team. If there are options, then it probably works.
Here, I've created a quick "Hello world" project whose sources I don't yet
have in Subversion. The Team menu option is in place, but will not
yet allow me to commit, update, etc.
-
- See the Subclipse installation tutorial in the useful links below for
this installation on Ganymede and to walk a few steps further than I have
here.
Using Eclipse Team menu on projects
In my experience, the best way to set up a new project in Eclipse that will be
under source code control is at creation. However, my discussion here
presupposes that your project exists already (and not that you're creating it
from scratch).
This discussion holds completely for Eclipse work on Linux.
Set up a Dynamic Java Project
- In the Package Explorer view, right-click and choose
New. If necessary (because it's not one of the "frequent"
choices), choose Dynamic Web Project under Web.
-
- Name the project.
-
- Uncheck the box Use defaulti, then click Browse.
-
- Navigate to the top of the filesystem location of your
project—already in Subversion. Click OK to establish this
path as the directory for the project contents. This will a) operate solely
on that path and b) not set up any filesystem structure in your Eclipse
workspace for the project. The workspace will, nevertheless, contain
information about the project (just no directories or files).
-
- Fill out the remaining dialog items as you normally would as well as the
information in the following dialogs. After you have done this, the project
will be created, use the existing source code out of your repository and be
ready for building.
Notes
- Creating a simple Java (not Dynamic Web) project happens similarly, but the
dialog box is slightly different; otherwise, it works identically:
- You will find that you can update your copy of what's in the Subversion
repository using TortoiseSVN or other Windows approaches (on Windows) or
svn on Linux and Macintosh independently of Subversive (i.e. not using
Team -> Update from inside Eclipse). All you must do in Eclipse
afterward is to right-click on the project affected (by the independent
filesystem operation) and choose Refresh.
- You will find Eclipse decoration of files and folders under repository
control confusing. When you modify a file, its icon in Package Explorer
will be
decorated with a black box in the lower right-hand corner. However, other
entities you have not (at least not intentially) modified will begin to sport
this decoration too. There are reasons for this, but some you must commit and
others you must not if you are collaborating on source-code development with
other team members.
Appendix: Some useful links