Associating existing Eclipse project with existing SVN repository - eclipse

I have an eclipse project on my hard disk, which is a fairly recent check out from an SVN repository. I've imported this project into my Eclipse workspace, and now want to associate it with the SVN repository.
How do I do this? The only options I seem to have under Right-click -> Team is "Share Project", which only seems to allow me to do an initial import.
Edit: Motivation - It's a largish repository, and I don't really want to have to import the whole thing over the network.
Edit 2: There are (for some reason) no .svn dirs in the project. So maybe a fresh import from svn is the only option

Team->Share project is exactly what you need to do. Select SVN from the list, then click "Next". Subclipse will notice the presence of .svn directories that will ask you to confirm that the information is correct, and associate the project with subclipse.

I just wanted to add that if you don't see Team -> Share project, it's likely you have to remove the project from the workspace before importing it back in. This is what happened to me, and I had to remove and readd it to the workspace for it to fix itself. (This happened when moving from dramatically different Eclipse versions + plugins using the same workspace.)
subclipse not showing "share project" option on project context menu in eclipse

I'm asked this question very frequently, if it's smart to use "Share project..." if a eclipse project has been disconnected from it SVN counterpart in the repository. So, I append my answer to this thread.
The SVN-Team option "Share project ..." is totally fine for projects that exist in SVN and in your Eclipse workspace, even if the Eclipse project is missing the hidden .svn configuration. You can still connect them. Eclipse SVN-implementation (Subclipse/Subversive) will verify if the provided SVN http(s) source is populated. If yes, all existing files will be copied and linked (checked out in SVN terms) to your very personal Eclipse workspace.
Word of caution:
Do a backup if you depend on you local files. The SVN implementation may vary its behaviour with every release.
If you have multiple projects encapsulated within each other, make sure you point the SVN path to the correct local path.
regards,
Feder

I came across the same issue. I checked out using Tortoise client and then tried to import the projects in Eclipse using import wizard. Eclipse did not recognize the svn location. I tried share option as mentioned in the above posts and it tried to commit these projects into SVN. But my issue was a version mismatch. I selected svn 1.8 version in eclipse (I was using 1.7 in eclipse and 1.8.8 in tortoise) and then re imported the projects. It resolved with no issues.

I am using Tortoise SVN client. You can alternativley check out the required project from SVN in some folder. You can see a .SVN folder inside the project. Copy the .SVN folder into the workspace folder. Now remove the project from eclipse and import the same again into eclipse. You can see now the project is now associated with svn

In case of SVN servers you have to creating a central repository with all projects. The contents of the repository can be uploaded with the Team/Share command; in case of the Subversive client it automatically runs a commit after the import, so you can upload your files.
This step cannot be circumvented in any way using a centralized version management system such as SVN.

Try this- Close the project then open it. It links with svn automatically,if project was checked out from valid svn path.

Related

Importing a project

I am new to Subversion. I'm using TortoiseSVN as my client and VisualSVN as the server. I want to implement it with fellow programmers who are working with me. Some are using NetBeans as their IDE while others are using Eclipse. My PC is the server and they are the clients.
How do they import a project made by me and make changes to it? Using TortoiseSVN they were able to browse my project, but how they import it in their IDEs and make changes to it? Will I be able to view the changes instantaneously?
Using TortoiseSVN they were able to browse my project
That means they have the url of your SVN repo.
They can load that repo to any folder of their choice.
svn checkout http://url/to/your/repo/trunk/ trunk
Or (TortoiseSVN)
From there, they need to add subversive to their eclipse:
They can import an existing project from their SVN workspace.
Once imported, you can re-connect that Eclipse project to its SVN repo:
(right click on the project, Team > Share)
Enter the relevant SVN repo metadata:
Eclipse has a plugin called "Subclipse" and another called "Subversive". They can find and install those to work with their Subversion working copy directly in Eclipse. Netbeans likely has something similar.
Or, once they have a working copy checked out by TortoiseSVN, they can just import it without any special plugins into their IDE. They would use the IDE for development, and use TortoiseSVN to manage all the Subversion aspects outside of the IDE.
You won't see any changes "instantaneously". For you to see their changes, they will first need to "commit" their changes, and then you will need to "update" to see their changes.
Since you're asking a really basic question about using Subversion, I'd suggest reading or at least skimming through important sections in the SVN book: http://svnbook.red-bean.com/

What should be committed to the repository in the Eclipse workspace?

I have a Eclipse installed to work with BIRT reports. What files in the workspace should be committed to the repository and what files should not?
Basically, any file able to help a developer checkout the repo and (almost) immediately open the project to work on it.
That should include at least eclipse files like .project, .classpath, and some IDE settings.
They might be some BIRT-specific settings as well.
See also:
Do you keep your project files under version control?
When working with Eclipse, should I add the workspace to the source control?

How to import an already checked out svn repository into Eclipse?

I have a Subversion repository I have checked out and have in my local hard disk. Now, how do I import this into Eclipse?
When I choose File > Import and choose SVN, there is only an option to checkout a project from the server again. File > New project seems to be for projects we are creating new projects from scratch.
"Import..." the existing project then "Share..." the project. The Subversive (or SubClipse) client will realize that the project has a .svn folder and reattach to the repository.
In Eclipse click on:
File -> Import -> General -> Existing Projects into Workspace
However you have to define a workspace location being different from the one that is being checked out in order to prevent yourself from changes to the checked out repository.
I've tried with File->Import Projects from File System or Archive, and in the blank space of Import source, you just need to browse through button Directory.. and find the project path you wanted to import. Then the svn connection is automatically detected.
Install the subversive plugin from market place or from update site.
Use appropriate SVN connectors during setup Windows->Preferances->Team->SVN->SVNConnectors. SVNKit 1.8.11 worked for me.
Make sure Enable automatic project share checkbox is set at this location Windows->Preferances->Team->SVN->General
Just import the existing SVN project File->Import->General->Existing Projects into Workspace, then eclipse will automatically recognize it based on the .svn hidden folder. Need not explicitly do Team->Share project.

Viewing repository information from within Eclipse, when code was checked out using svn tortoise

I am using svn tortoise to checkout a maven project from a repository, I then open eclispe, and use the m2eclipse plugin to import a maven project. The maven projeect comes in okay, and I can build it fine.
The problem is that eclipse using subversive, isn't marking files/ resources as being in source control (even though I seem to have all the relevant .svn directories.)
I get the same behaviour if I try and check the code in using
-> import -> check out Maven Projects from SCM. ie the project imports okay, but the files aren't linked in to teh svn repository in eclipse.
Are there any suggestions as to how I might proceed, as I find the tortoise svn checkin process pretty painful.
Did you set up your project for team sharing (right click on project->Team->Share project)? If I remember correctly that should detect the existing .svn folders an enables version control inside of eclipse.
You might wanna try using Subclipse. It's the Eclipse plug-in for Subversion and is really good. I've also found that interacting with a SVN repository with Tortoise while also having Eclipse open and accessing the same repository causes problems. You should avoid it if you can.
I would highly recommend making sure that you commit using tortoise svn as I've had particularly spotty consistency with subclipse. If you do you in/out with tortoise, and then just update with subclipse you should be fine.

Eclipse "Share Project" by hand?

What actually happens to the file system when you do a Subclipse Share Project on an Eclipse project that was externally checked out from Subversion? All the .svn folders are already in place. I get an error when I try to Share Project the right way, and I'd rather not delete and re-checkout the projects from the SVN Repository browser.
Dunno exactly what happens within eclipse, I presume it does some funky stuff in the .metadata directory of the workspace. That said, I would recommend the following to get eclipse to learn about the svn settings of the project:
Delete the project from the workspace (keep "Delete project contents on disk" unchecked)
File > Import... > General > Existing Projects into Workspace
Browse to the folder containing the original project(s) of interest
Import the projects into your workspace
This seems to have the side effect of subclipse noticing the subversion settings when importing the "new" projects into your workspace.
The Share Project action is intended to commit the first version of a project, i.e. one with no .svn metadata in place. It will get upset if it sees .svn directories already there. As Rob wrote, the way to get that checked-out project into Eclipse is to use the import capability.
I'm not sure what version of Eclipse you are using or whether this will apply since I'm using Subversive instead of Subclipse. When I use the share project feature to commit the project into svn when I already have all of the .svn directories in place, I get a choice of like "Use current project settings" and then eclipse automatically reattaches the project svn information to the team integration. You can screw it up if you try to enter different information.