恢复 Eclipse subversion 项目连接

我有一个 subversion 项目,我正在使用 Eclipse 开发它。我在 Eclipse 内部从 svn 存储库进行了原始的签出。几个星期以来一切都很好,但是由于某些未知的原因,Eclipse (特别是 Ganymede 的 subclise)不再认为我的项目在 svn 的控制之下。团队上下文菜单只显示基本的“应用补丁”/“共享此项目”菜单选项。在 shell 中,我仍然可以使用 svn 命令行工具更新项目,因此我知道 svn 凭据仍然可以工作。在同一个 Eclipse 副本中的其他颠覆项目仍然可以工作。

我意识到我可以删除本地拷贝并再次检查它,但我更愿意理解出了什么问题——修复问题,而不是掩盖症状。Eclipse 在哪里存储其关于哪些项目处于版本控制之下的知识?我查看了 .project文件和 .settings目录,但是看不到任何明显提到 svn 性质或类似内容的地方,即使在仍然正常工作的项目中也是如此。

64943 次浏览

If you are using sublipse as your SVN provider I recommend doing the following

Team -> Share project is usually enough to connect the metadata.

(that is, assuming that the .svn files are still there which they seem to be if you can work on the command line).

Hope this helps as to why this would happen I have no idea

Without knowing what platform you're on, I don't know if your problem is similar to mine. However, I have recently (actually on two different platforms!) had issues where an update to Subversive (or perhaps Eclipse itself, not clear) caused the connectors to no longer load. Without the connectors, Subversive cannot connect to a project. But Eclipse isn't going to lock you out of your project over that, it'll just remove the SVN-related functionality.

Look at the Errors view, which is a log of Eclipse's various errors (class-not-found exceptions, etc.) and see if there are any lines that related to the Subversive components. Unfortunately, I can't really recommend a solution-- on my Mac OSX platform it was enough to re-install the Subversive core elements and connectors. On my Linux machine (possibly due to an OS upgrade) I'm having to completely re-install Eclipse, as too much cruft has accumulated for me to be able to fully investigate it.

Addendum: it turns out that my problem manifests when I start Eclipse outside the company vpn, with a project in the workspace that is attached to a svn repository inside the vpn. Fortunately, switching Eclipse svn plugins from subversive to subclipse did solve it.

Ian

Same in my case: .svn dirs were there, but my project didn't support svn actions.

After a bit of poking it turned out that subversive plugin just disappeared after a forced quitting eclipse.

The solution was to (re)install subversive, and now everything is fine again.

Cheers v.

UPDATE: I have switched eclipse to a new version that just didn't have the plugin installed, which is the reason why I had to install it from scratch.

I had the same problem and this forum helped me in finding the right answer.

My earlier project was configured using subclipse. The new eclipse had subvesive.

Installing subclipse helped me get back the svn options under team!

Hope it helps someone else.

regards

Anshu Prateek

I found an easy way just reimport the project

Just doing Team -> Share Project (per the answer to this question provided by @Paul Whelan) did not work for me. The Share Project wizard acted as though the project was not already in SVN (even though the .svn folder was present for my project).

I ended up resolving the issue by uninstalling the Subversive and JavaHL add-ons (via Help | About Eclipse | Installation Details button | Installed Software tab | Uninstall...), and then reinstalling Subversive. When prompted after restarting Eclipse, I opted to install the SVNKit connector rather than the JavaHL connector.

After having done that, when I once again tried Team -> Share Project..., Eclipse correctly recognized that my project was already present in SVN, and it successfully restored the connection.

From eclipse, I closed the project(s) and reopened which resolved the problem. All by SVN links are back for all projects in my workspace.

In the Juno release with Subversive, I did:

  • File/Import brings up the Import popup.
  • From there, select General/Existing Projects in to Workspace.
  • In the next pane, you select the root directory. Then it will show you all the subdirectories. They'll all be selected by default.
  • Unselect the ones you don't want.

It will then "import" your existing directory, which can be used in-place they are already located inside your workspace directory.

This worked for me: right click-> TortoiseSVN -> Settings -> Icon Overlay properties, Selecting Shell as Status Cache. Click Ok, Refresh page.

I can reliably reproduce this problem—it happens when checking out certain Maven projects by running "Check out as Maven Project…" not on the folder containing the POM itself but on a parent directory (such as "trunk"). In this case Subclipse checks out the project without any complaints, putting it in a workspace directory with a placeholder name such as maven.1424425443350. Inside this directory it creates a subdirectory with the name of the Maven artifact. This confuses both Subclipse and Subversion: Subclipse, as we've seen, immediately forgets that the project is under version control, and if you invoke svn status from the command line in the maven.1424425443350 directory, it will tell you that the directory is under version control but that all the version-controlled files are missing.

None of the workarounds presented in the other answers will work if this is what caused Subsclipse to forget its SVN connection. Instead, the only solution is to delete the project and check it out again, this time making sure that the checkout is performed on a directory containing a POM rather than some higher-level directory.

A better overall solution would be for Subclipse to refuse to run "Check out as Maven Project…" on directories which don't contain a POM, or else to better handle cases where it tries to do so anyway by searching subdirectories for Maven projects.

I was using two SVNKit implementations (1.7.x and 1.8.x) simultaneously with the SVN repository version (1.8.x).

As a result the Team -> Share projects... always requested a commit message. Obviously, SVNKit 1.7.x was used which is not compatible with SVN 1.8.x.

After removing SVNKit 1.7.x eclipse used the only available correct SVNKit version 1.8.x and everything worked as expected.

My .svn metadatas folder were deleted.

None of the solutions here worked for me (close/reopen project, delete/reimport, still unlinked)

Following steps worked for me:

  • BEFORE ALL backup source project PROJECT/ folder to BAK/
  • Eclipse > on Project:
    • Delete project, choose yes for "Delete content too?"
    • Team > checkout as fresh project, recursive
    • restores all up-to-date content and the .svn folders
  • Close Eclipse
  • Copy / override from BAK/ to PROJECT/:
    • optional, .classpath and .project files ⇾ restores Project (Java) natures, setup, build path, ... if yours was modified compared to server version (I needed to)
    • optional, all source files and folders ⇾ restores your latest local changes (I needed to)
  • Open Eclipse
  • Eclipse > File > Import project

The project is now restored, it builds and is linked to subversion again, with the latest local recent changes kept if any.