Setting up a local Subversion repository to use with your Eclipse

Rickard Nilsson

I've been spending some time studying a tool for looking at the structure of code bases. After having tried out some of the more basic possibilities I wanted to go for the finer points and study changes between two versions of code to see what effect my changes made. This is where I realise that I would like to have a local Subversion repository not only for this, but also for how it would benefit some of my hobby projects. After some googling I found my way to http://subversion.tigris.org/project_packages.html where, since I'm on windows, I picked the windows path. I end up downloading the latest version of Subversion: http://subversion.tigris.org/files/documents/15/45344/svn-win32-1.6.0.zip

I unpack it in "C:\Program Files\Subversion". To get the commands to work you have to add the bin to your path. In my case I add "C:\Program Files\Subversion\svn-win32-1.5.6\bin" to the path. After this I open up a command window and do the following:

mkdir subversionRepository
cd subversionRepository
svnadmin create project1

Now, in order to make Subversion work in Eclipse I add http://subclipse.tigris.org/update_1.6.x to my update sites. After downloading this I restart my Eclipse and go to Window -> Show View ->Other->SVN -> SVN Repositories.
I right click in the opened view and create a new repository location. Instead of writing a http adress in the URL window I now type "file:///C:/subversionRepository/project1". Notice the three forward slashes after "file:".

I now have an empty repository that I want to put my project into so I right click on the repository and add a new remote folder that I call trunk. Right clicking on the trunk I can now import my project by importing the folder that contains the .project file. I hit F5 to refresh the view and can see that the trunk is now filled with my first version of my project.

But I also have to associate the repository version with Eclipse, so now I right click in the Package Explorer and choose Import -> SVN -> Checkout Projects from SVN. I pick my previously created repository, click next, mark the trunk and then click finish. I get a question if I want to overwrite my previously created project with the same name and say ok. I won't need that now that I got a versioning system!

I can now finally continue my studies of the tool I was looking into.

Rickard Nilsson
Consultant at Jayway

Tags: , , , , ,

13 comments ↓

#1 Doug on 07.31.09 at 9:38

This was a great writeup on the very thing I was looking to do, thank you for the great help.

#2 Art on 08.18.09 at 0:09

Great. Short and to the point. Saved me from thrashing around.
Thanks!

#3 Dave Benson on 09.21.09 at 21:02

Thanks, man. Just what I was looking for…!

#4 TudorD on 10.27.09 at 21:25

Yeah. Thanks, it was quite helpful.

#5 lynton on 01.14.10 at 6:16

thanks for the quick and easy svn / subclipse setup tip, especially useful b/c you described how to do it from existing project source.

now my eclipse project source is snugly and safely version controlled.

#6 Oded on 01.20.10 at 15:49

Why can’t life always be as simple as this…? thank you!

#7 Rob on 05.18.10 at 10:24

This was exactly what I was looking for. Thanks a lot.

#8 Abhishek on 06.15.10 at 8:03

Thanks for this useful article. This should be put on subclipse website. Thank you.

#9 Enrique on 09.26.10 at 16:02

Just to say Thank You!
Also I want to add something, It’s not neccesary to install Subversion, if you install TortoiseSVN you can make the repository with it and it will work too.

#10 Amyne on 01.11.11 at 21:59

Thanks A lot for your helpful tip , but when i was searching for the local svn server , i found another easy way… there is a software called Visual svn you can create local ripositories and managed them with an easy and efficiant way !
Downalod link here : http://www.visualsvn.com

#11 Zach on 03.19.11 at 17:03

Now you have a local SVN setup, how do I share his with people I want to work with?

#12 belal on 08.01.11 at 1:31

thanks for sharing , looking for this from long time

#13 jordi on 11.28.11 at 21:09

Great article! Thank you very much!

Leave a Comment