Getting started with Subversion
Nowadays Git and Mercurial are the most widely used version control systems. It can be said that they succeeded the former used CVCS in nearly all areas. Nevertheless there is still a loyal user community of Subversion (SVN). Until today older repositories remain of importance. Subversion, is an open source alternative to the well known CVS. This article focuses on this last great version control system supported by SCM-Manager and it’s integration into the Eclipse development environment. Please note that this is a beginners tutorial focusing on the basics. This is the last post in our beginners series about the most common version control systems in Eclipse. Previous articles were Git and Mercurial.
Installation of Subversion in Eclipse
While CVS is integrated in Eclipse, SVN is not. There are two main different plugins available to add SVN support: Subclipse and Subversive. At the Eclipse marketplace you can find both plugins and since both feature all SVN capabilities it is a question of taste which one you want to use. It is possible to install them side-by-side, hence it’s no problem to test both of them and choose a personal favorite. Some users report that Subversive might be a little bit faster than Subclipse, but we did not find any measurable prove.
Because installation and usage of these plugins resemble each other, we will treat them as one and only point out variations as they occur.
Use version control in your project
Eclipse allows two options of adding SVN connection to a project: add a new connection to existing code or build a new project from an existing repository codebase.
To add version control using SVN to your project you need an existing repository to commit your changes. This will be provided by your administrator or, if you use SCM-Manager and have the appropriate rights, you can simply add a new Subversion repository via SCM-Manager’s web interface.
Right-click the project in the “Package Explorer” then select “Team → Share Project…“ and choose SVN in the the following dialog. If this is your first time to use one of the Subversion plugins you will be asked to add a repository location. This location will be saved and is available for later use in other projects of your workspace.
Note: Subversive and Subclipse do not share their repositories. Therefore you have to add the locations separately for both of them.
Enter your user name and password and Finish the dialog.
The “Package Explorer” indicates that your project is now under version control by Subversion.
To add a new project from existing code in Subversion you choose “New → Project → SVN → Project From SVN”. Add your repository location as described above. Now finish the dialog by choosing the type of project you want to add and Eclipse will add a new project connecting Subversion to your workspace.
Hint: If you want to disconnect a project afterwards, right-click the project and choose “Team → Disconnect”.
Now that the project is successfully configured you can try out your first commit.
Commit changed code to repository
To commit your changes right-click the project in the Project Navigator and choose “Team → Commit”.
Subversion and SCM-Manager
That’s it, now you can use Subversion in Eclipse. Subversion might be an older representative of version control systems it is still used through a wide range of projects. However we recommend you to check out a distributed version control system like Git or Mercurial. These are more likely to fit the demands of modern work processes. With SCM-Manager you can host and manage repositories of different kinds on the same server.