How do you make eclipse use an existing svn working copy?

Viewed 28895

I've got a working copy checked out with svn; furthermore, I've created a new project in Eclipse that has the root of the working copy as the project's location. I want to be able to do stuff like compare versions from Eclipse. I have Subclipse 1.4.8, but that doesn't seem to give me what I want. Am I doing something wrong?

13 Answers

There is an option when creating a new project, to use an existing source directory:

New project/ new Java Project / Create project from existing source.

Use that, tell it where your source lives, and it should automatically detect if it's a SVN working copy.

I guess this is not possible with Subclipse as it's given in its documentation that, you can only import an existing svn-managed folder under one condition, according to the doc:

"The only requirement is that your working copy has to also be a valid Eclipse project."

So, if you have a working copy that is not a complete eclipse project, Subclipse will not connect it to SVN.

I am answering this after a long time of the question being asked. I ended up here because I was facing the same problem.

My solution was to create an empty .svn folder at the root folder of the project (in the latest version of svn client tortoise all meta-data is at the root folder). Then did an eclipse refresh and voila it did the trick. I am running subclipse core - 1.8.4.

Add the repository to your list of repositories in subclipse by choosing Window->Show View->Other... and choose SVN->SVN Repositories. Put in all the necessary info to connect to the repository.

Next, right click the repository and choose "checkout". If the project doesn't already have an eclipse .project file, you can create a new project from the source. If it already has a .project file, it will import that .project and use that as your eclipse project locally.

It will definitively not work if you use a different version of svn to checkout, that the one that is supported by Eclipse. I had this problem as I used svn 1.6 to checkout but I had an older eclipse version that had only 1.5. Subclipse has its own build-in svn client (Actually, in two flavors if I am not mistaken).

Check that the subclipse version matches the svn client that you used to checkout. You can check the plugin version number for subclipse (Help -> About -> Click on subversion logo) and match it against svn --version

I have encountered a similar situation were existing projects would not get associated with the Subversive plugin. Unfortunately, none of the previous suggestions helped (renaming projects etc.). What has helped is removing projects from Eclipse by deleting them -- just the projects from Package Explorer and not the actual directories and files on disc (the deletion prompt has a special checkbox for that, which is unchecked by default) -- and reimporting the deleted projects as existing projects back.

Of course, as mentioned in some of the answers here, the relevant SVN repositories need to be registered with Eclipse before reimporting the projects. Otherwise, there would no repositories to re-associate the projects with.

When you open a versioned project (i.e., a project in SVN working copy) in Eclipse, that was never previously used with Subclipse, you need to perform these steps:

  1. Right-click the project in Project Explorer.
  2. Select Team | Share Project.
  3. At this point Subclipse will tell you that "The project is already configured with SVN repository information". Click Next.

Subclipse automatically recognizes this project as versioned and all the features of the SVN plug-in should become available.

Related