Tuesday, November 24, 2009

Local Subversion repository with Eclipse

Today I installed Subversion (SVN) on my notebook. I needed versioning for local development. A simple way is to create a file-based repository and connect to it with an eclipse svn client. Follow these steps:

  • Download & install Subversion for Mac
  • Install Eclipse Subversion client plugins
  • Share an Eclipse project in a local repository

Here are the details:

Download & install Subversion for Mac

You can get Subversion for Mac (and other OS's) here. I used the universal openCollabNet binary. Just follow the install instructions of the installer...

It is recommended to add the Subversion bin directory to the system $PATH variable (if you're lazy like me). For example you can edit one of the following files:

  • /etc/profile (system wide .profile for sh)
  • /Users/<you>/.profile (users .profile, loaded at login)
  • /Users/<you>/.bash_profile (users .profile, (re-)loaded with new terminal window)

The .bash_profile was my choice but you can use all of them. Add the following lines:

Btw: Currently I use the non-commercial editor TextWrangler. It's a great tool! The shell command edit <file> opens a gui editor for <file>.

Install Eclipse Subversion client plugins

There are currently two popular SVN plugins for Eclipse: Subclipse and Subversive. The latter is my favourite:

  1. Click Help and Install New Software
  2. Install Subversive SVN Team Provider
    • Choose Site: Galileo (included in Eclipse 3.5)
    • Install: Subversive SVN Team Provider (Incubation)
  3. Install Subversive SVN Connectors
    • Choose site: http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/
    • Install: Subversive SVN Connectors SVNKit 1.3.0 Implementation
  4. Restart Eclipse, if asked

Share an Eclipse project in a local repository

Open a terminal (current location: /Users/<you>) and create a local SVN repository:

In the Eclipse Project Explorer richt-click on a project and...

  • Choose Team -> Share Project...
  • Repository Type: SVN
  • Create a new repository location
  • Enter URL: file:///Users/<you>/svn.repository/myFirstRepository and press Finish
  • Finally add the project to repository

Use the Team Synchronization perspective to sync your changes.