如何恢复损坏的Eclipse工作区?

时间:2021-08-04 20:54:30

I just managed to corrupt contents of my Eclipse .metadata directory. Starting up with eclipse -clean did not work out. Deleting .metadata and then importing all projects, plugins and setting does not sound too interesting. I ended up moving .metadata/.plugins/org.eclipse.core.resources/ elsewhere and reimporting my projects only.

我只是设法破坏了我的Eclipse .metadata目录的内容。启动eclipse -clean没有成功。删除.metadata,然后导入所有项目,插件和设置听起来不太有趣。我最终移动.metadata / .plugins / org.eclipse.core.resources /其他地方并重新导入我的项目。

Are there any tools or best practices to recover workspace?

是否有任何工具或最佳实践来恢复工作空间?

15 个解决方案

#1


I have some experience at recovering from eclipse when it becomes unstartable for whatever reason, could these blog entries help you?

我有一些从eclipse中恢复的经验,当它因任何原因变得不可思议时,这些博客条目可以帮助你吗?

http://blog.chris-alex-thomas.com/2009/08/26/eclipse-refuses-to-start-again/

also search for "cannot start eclipse" (I am a new user, I can only post a single hyperlink, so I have to just ask that you search for the second :( sorry)

还搜索“无法启动eclipse”(我是新用户,我只能发布一个超链接,所以我只想问你搜索第二个:(对不起)

perhaps those allow you to recover your workspace as well, I hope it helps.

也许那些允许你恢复你的工作区,我希望它有所帮助。

#2


When workspace is damaged and Eclipse cannot start, even using the -clean option, removing single file workspace/.metadata/.plugins/org.eclipse.core.resources/.snap may help (source: comments to article http://letsgetdugg.com/2009/04/19/recovering-a-corrupt-eclipse-workspace/).

当工作空间损坏且Eclipse无法启动时,即使使用-clean选项,删除单个文件工作空间/ .metadata / .plugins / org.eclipse.core.resources / .snap也可能有所帮助(来源:评论文章http:// letsgetdugg的.com / 2009/04/19 /回收-A-腐败-Eclipse的工作区/)。

Update: when Eclipse 4.X cannot start after crash, try to start with -clearPersistedState option; if it didn't help then remove file workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi (sources: http://www.eclipse.org/forums/index.php/m/1269045/ http://www.eclipse.org/forums/index.php/t/522428/ https://bugs.eclipse.org/bugs/show_bug.cgi?id=404873). Note: you'll lose configuration of your perspective/views/tabs.

更新:当Eclipse 4.X在崩溃后无法启动时,请尝试以-clearPersistedState选项启动;如果它没有帮助,那么删除文件工作区/ .metadata / .plugins / org.eclipse.e4.workbench / workbench.xmi(来源:http://www.eclipse.org/forums/index.php/m/1269045 / http://www.eclipse.org/forums/index.php/t/522428/ https://bugs.eclipse.org/bugs/show_bug.cgi?id=404873)。注意:您将丢失透视图/视图/标签的配置。

Update: Subversive plugin may be responsible for unability to start Eclipse with corrupted metadata. If you have Subversive plugin installed, update it to latest build (at least 0.7.9.I20120210-1700) from update-site. Related bugs 372621 and 370374 were fixed by Subversive developers.

更新:颠覆性插件可能导致无法使用损坏的元数据启动Eclipse。如果您安装了Subversive插件,请从update-site将其更新到最新版本(至少为0.7.9.I20120210-1700)。相关的错误372621和370374由Subversive开发人员修复。

#3


You should be able to start your workspace after deleting the following file: .metadata.plugins\org.eclipse.e4.workbench\workbench.xmi as shown here :

您应该能够在删除以下文件后启动工作区:.metadata.plugins \ org.eclipse.e4.workbench \ workbench.xmi,如下所示:

#4


I haven't been able to avoid rebuilding workspace occasionally (one or twice over several years of using eclipse). Delete the .metedata and rebuild.

我偶尔也无法避免重建工作空间(使用eclipse几年后一两次)。删除.metedata并重建。

#5


I have succesfully recovered my existing workspace from a totally messed up situation (all kinds of core components giving NPE's and ClassCastExceptions and the like) by using this procedure:

通过使用以下过程,我成功地从完全混乱的情况(各种核心组件提供NPE和ClassCastExceptions等)中恢复了我现有的工作区:

  • Open Eclipse
  • Close error dialog
  • 关闭错误对话框

  • Select first project in the workspace
  • 在工作区中选择第一个项目

  • Right-click -> Refresh
  • 右键单击 - >刷新

  • Close error dialog
  • 关闭错误对话框

  • Close Eclipse
  • Close error dialog
  • 关闭错误对话框

  • Repeat for all projects in the workspace
  • 对工作区中的所有项目重复此操作

  • (if your projects are in CVS/SVN etc, synchronize them)
  • (如果你的项目是在CVS / SVN等,同步它们)

  • Clean and rebuild all projects
  • 清理并重建所有项目

  • Fixed

This whole procedure took me over half an hour for a big workspace, but it did fix it in the end.

这整个过程花了我半个多小时的时间来完成一个大工作空间,但它确实最终解决了这个问题。

#6


One more solution that I've discovered by accident, and may help someone:

我偶然发现的另一个解决方案,可能会帮助某人:

  1. Back up the corrupted workspace.
  2. 备份损坏的工作区。

  3. Move half of you projects to some temporary location.
  4. 将一半项目移动到某个临时位置。

  5. Start Eclipse, if it works, go to step 5.
  6. 启动Eclipse,如果有效,请转到步骤5。

  7. Move the half of projects you've removed back into the workspace, move out the other half. If you've already done that, keep removing/readding your projects in a binary search manner. Go to step 3.
  8. 将已移除的项目的一半移回工作区,移出另一半。如果您已经这样做了,请继续以二进制搜索方式删除/读取项目。转到第3步。

  9. Exit Eclipse, move back all your projects, and start it again. You should see now that some of your projects are closed (and in the wrong working sets). Re-open your projects and move them to the correct working sets.
  10. 退出Eclipse,移回所有项目,然后重新启动它。您现在应该看到一些项目已关闭(并且在错误的工作集中)。重新打开项目并将其移动到正确的工作集。

In my case, it was a project that got corrupted, and not the entire workspace (attempting to import said project into a fresh workspace caused it to fail as well). So, I've started to search for the faulty project - instead, I got the result described above.

就我而言,这是一个被破坏的项目,而不是整个工作区(尝试将所述项目导入新的工作区也导致它失败)。所以,我已经开始寻找错误的项目了 - 相反,我得到了上面描述的结果。

#7


This thread may be a bit older, but since this still is a problem nowadays, I thought I’d propose a new solution for backing up Eclipse.

这个线程可能有点旧,但由于现在这仍然是一个问题,我想我会提出一个新的解决方案来备份Eclipse。

  • At http://profiles.yatta.de you can download the Yatta Eclipse Launcher. You can use it to save your Eclipse and workspace setup.

    在http://profiles.yatta.de,您可以下载Yatta Eclipse Launcher。您可以使用它来保存Eclipse和工作区设置。

  • After installation, the Launcher will discover your existing Eclipse installations and workspaces.

    安装后,Launcher将发现您现有的Eclipse安装和工作区。

  • Click the Upload & Share button (the blue one) on the right of the entry you want to back up.

    单击要备份的条目右侧的“上载和共享”按钮(蓝色按钮)。

(You won’t actually “share” your Eclipse or workspace with anyone. You’ll just upload a setup file with your metadata that only you have access to yourself . You could share this later, but you can also just use it as a backup).

(您实际上不会与任何人共享您的Eclipse或工作区。您只需上传一个包含元数据的设置文件,只有您可以访问自己。您可以稍后分享,但您也可以将其用作备用)。

If you do that, you’ll be able to re-setup your IDE really fast if you ever have a fragged workspace or Eclipse installation.

如果您这样做,如果您有一个碎片工作区或Eclipse安装,您将能够非常快速地重新设置IDE。

#8


I know this sounds obvious, but if I'm writing code for a living I would be sure to do a full backup weekly, with corresponding incremental backups daily.

我知道这听起来很明显,但如果我以编写代码为生,我肯定会每周进行一次完整备份,每天都会进行相应的增量备份。

Simple and easy recovery.

简单易用的恢复。

For a simple way to backup your eclipse directory and assuming your using Linux, you could use rsync.

有关备份eclipse目录并假设使用Linux的简单方法,可以使用rsync。

rsync -ar <eclipse-dir> <backup-eclipse-dir>

rsync -ar

You can put this in cron and have it backup your files automatically. It will only copy over the changed files to your backup-eclipse-dir on subsequent runs.

您可以将它放在cron中并让它自动备份您的文件。它只会在后续运行时将已更改的文件复制到backup-eclipse-dir。

#9


In my case only removing org.eclipse.e4.workbench directory (under .metadata/.plugins) and restarting Eclipse solved the problem.

在我的情况下,只删除org.eclipse.e4.workbench目录(在.metadata / .plugins下)并重新启动Eclipse解决了这个问题。

#10


None of the above worked for me. But what actually worked was deleting all *.snap files from my workspace. This also preserves almost all settings including imported projects. Make sure to back up the workspace before trying it though!!!

以上都不适合我。但实际工作的是从我的工作区删除所有* .snap文件。这也保留了几乎所有设置,包括导入的项目。确保在尝试之前备份工作区!

#11


Remove a file with .dat extension in workspace/.metadata/.plugins/org.eclipse.wst.jsdt.core/ and then close eand open eclipse, maybe you cannot close eclipse, force it, with pkill -f eclipse if you are on linux or similar.

删除工作区/ .metadata / .plugins / org.eclipse.wst.jsdt.core中扩展名为.dat的文件,然后关闭eand open eclipse,也许你不能关闭eclipse,强制它,如果你是pkill -f eclipse在linux或类似的。

This solution avoid to import all of existents projects.

此解决方案避免导入所有exates项目。

#12


I also experienced an issue like this, my workspace was corrupted and didn't do all the important things anymore.

我也经历过这样的问题,我的工作区已损坏,并且不再执行所有重要的事情。

For some reason, I had a corrupt resource on one of my projects. It didn't show up in the package tree, but it did show in the error log in Eclipse as

出于某种原因,我的一个项目有一个腐败的资源。它没有显示在包树中,但它确实在Eclipse的错误日志中显示为

Error while creating a link for external folder X:\somefolder

创建外部文件夹X的链接时出错:\ somefolder

After checking every project (because the error didn't point to one), I indeed found this resource in one of the build paths (in Configure Build Path menu it did show an error icon!) and deleted it.

在检查每个项目之后(因为错误没有指向一个),我确实在其中一个构建路径中找到了这个资源(在Configure Build Path菜单中,它确实显示了一个错误图标!)并将其删除。

See Eclipse (Kepler) Workspace acting weird (type hierarchy, searching for references not working) for a wider description of my issue if you're experiencing something similar.

如果您遇到类似的问题,请参阅Eclipse(Kepler)工作空间行为很奇怪(类型层次结构,搜索不起作用的引用)以获得更广泛的问题描述。

Posted this for future developers to reference.

发布此内容供以后的开发人员参考。

#13


deleting below file helped me solve my eclipse start up issue. Perforce plugin has always troubled me especially when my machine reboots, next time eclipse tries to recover workspace and craps out.

删除下面的文件帮我解决了我的eclipse启动问题。 Perforce插件总是困扰我,特别是当我的机器重新启动时,下次eclipse试图恢复工作区并疯狂。

workspace/.metadata/.plugins/org.eclipse.core.resources/.snap

For your reference, Error I was getting: org.eclipse.core.runtime.CoreException: Plug-in com.perforce.team.ui was unable to load class com.perforce.team.ui.UITeamProvider.

供您参考,错误我得到:org.eclipse.core.runtime.CoreException:插件com.perforce.team.ui无法加载类com.perforce.team.ui.UITeamProvider。

#14


In my case, it was not the workspace that was broken but Eclipse itself. Even though it seemed like workspace is broken (the same error dialog, etc.), all I had to do was reinstall Eclipse and point it to the old workspace. You can't really repair a broken workspace if it is the workspace that is broken but you can do so just for good measure, maybe it'll work.

在我的例子中,它不是被破坏的工作区而是Eclipse本身。即使看起来像工作区被破坏(相同的错误对话框等),我所要做的就是重新安装Eclipse并将其指向旧工作区。你不能真正修复一个破碎的工作区,如果它是破碎的工作区,但你可以这样做只是为了好的措施,也许它会工作。

#15


If the workspace is not that big you could backup to say dropbox as a private locked folder.

如果工作区不是那么大,您可以备份将Dropbox称为私有锁定文件夹。

#1


I have some experience at recovering from eclipse when it becomes unstartable for whatever reason, could these blog entries help you?

我有一些从eclipse中恢复的经验,当它因任何原因变得不可思议时,这些博客条目可以帮助你吗?

http://blog.chris-alex-thomas.com/2009/08/26/eclipse-refuses-to-start-again/

also search for "cannot start eclipse" (I am a new user, I can only post a single hyperlink, so I have to just ask that you search for the second :( sorry)

还搜索“无法启动eclipse”(我是新用户,我只能发布一个超链接,所以我只想问你搜索第二个:(对不起)

perhaps those allow you to recover your workspace as well, I hope it helps.

也许那些允许你恢复你的工作区,我希望它有所帮助。

#2


When workspace is damaged and Eclipse cannot start, even using the -clean option, removing single file workspace/.metadata/.plugins/org.eclipse.core.resources/.snap may help (source: comments to article http://letsgetdugg.com/2009/04/19/recovering-a-corrupt-eclipse-workspace/).

当工作空间损坏且Eclipse无法启动时,即使使用-clean选项,删除单个文件工作空间/ .metadata / .plugins / org.eclipse.core.resources / .snap也可能有所帮助(来源:评论文章http:// letsgetdugg的.com / 2009/04/19 /回收-A-腐败-Eclipse的工作区/)。

Update: when Eclipse 4.X cannot start after crash, try to start with -clearPersistedState option; if it didn't help then remove file workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi (sources: http://www.eclipse.org/forums/index.php/m/1269045/ http://www.eclipse.org/forums/index.php/t/522428/ https://bugs.eclipse.org/bugs/show_bug.cgi?id=404873). Note: you'll lose configuration of your perspective/views/tabs.

更新:当Eclipse 4.X在崩溃后无法启动时,请尝试以-clearPersistedState选项启动;如果它没有帮助,那么删除文件工作区/ .metadata / .plugins / org.eclipse.e4.workbench / workbench.xmi(来源:http://www.eclipse.org/forums/index.php/m/1269045 / http://www.eclipse.org/forums/index.php/t/522428/ https://bugs.eclipse.org/bugs/show_bug.cgi?id=404873)。注意:您将丢失透视图/视图/标签的配置。

Update: Subversive plugin may be responsible for unability to start Eclipse with corrupted metadata. If you have Subversive plugin installed, update it to latest build (at least 0.7.9.I20120210-1700) from update-site. Related bugs 372621 and 370374 were fixed by Subversive developers.

更新:颠覆性插件可能导致无法使用损坏的元数据启动Eclipse。如果您安装了Subversive插件,请从update-site将其更新到最新版本(至少为0.7.9.I20120210-1700)。相关的错误372621和370374由Subversive开发人员修复。

#3


You should be able to start your workspace after deleting the following file: .metadata.plugins\org.eclipse.e4.workbench\workbench.xmi as shown here :

您应该能够在删除以下文件后启动工作区:.metadata.plugins \ org.eclipse.e4.workbench \ workbench.xmi,如下所示:

#4


I haven't been able to avoid rebuilding workspace occasionally (one or twice over several years of using eclipse). Delete the .metedata and rebuild.

我偶尔也无法避免重建工作空间(使用eclipse几年后一两次)。删除.metedata并重建。

#5


I have succesfully recovered my existing workspace from a totally messed up situation (all kinds of core components giving NPE's and ClassCastExceptions and the like) by using this procedure:

通过使用以下过程,我成功地从完全混乱的情况(各种核心组件提供NPE和ClassCastExceptions等)中恢复了我现有的工作区:

  • Open Eclipse
  • Close error dialog
  • 关闭错误对话框

  • Select first project in the workspace
  • 在工作区中选择第一个项目

  • Right-click -> Refresh
  • 右键单击 - >刷新

  • Close error dialog
  • 关闭错误对话框

  • Close Eclipse
  • Close error dialog
  • 关闭错误对话框

  • Repeat for all projects in the workspace
  • 对工作区中的所有项目重复此操作

  • (if your projects are in CVS/SVN etc, synchronize them)
  • (如果你的项目是在CVS / SVN等,同步它们)

  • Clean and rebuild all projects
  • 清理并重建所有项目

  • Fixed

This whole procedure took me over half an hour for a big workspace, but it did fix it in the end.

这整个过程花了我半个多小时的时间来完成一个大工作空间,但它确实最终解决了这个问题。

#6


One more solution that I've discovered by accident, and may help someone:

我偶然发现的另一个解决方案,可能会帮助某人:

  1. Back up the corrupted workspace.
  2. 备份损坏的工作区。

  3. Move half of you projects to some temporary location.
  4. 将一半项目移动到某个临时位置。

  5. Start Eclipse, if it works, go to step 5.
  6. 启动Eclipse,如果有效,请转到步骤5。

  7. Move the half of projects you've removed back into the workspace, move out the other half. If you've already done that, keep removing/readding your projects in a binary search manner. Go to step 3.
  8. 将已移除的项目的一半移回工作区,移出另一半。如果您已经这样做了,请继续以二进制搜索方式删除/读取项目。转到第3步。

  9. Exit Eclipse, move back all your projects, and start it again. You should see now that some of your projects are closed (and in the wrong working sets). Re-open your projects and move them to the correct working sets.
  10. 退出Eclipse,移回所有项目,然后重新启动它。您现在应该看到一些项目已关闭(并且在错误的工作集中)。重新打开项目并将其移动到正确的工作集。

In my case, it was a project that got corrupted, and not the entire workspace (attempting to import said project into a fresh workspace caused it to fail as well). So, I've started to search for the faulty project - instead, I got the result described above.

就我而言,这是一个被破坏的项目,而不是整个工作区(尝试将所述项目导入新的工作区也导致它失败)。所以,我已经开始寻找错误的项目了 - 相反,我得到了上面描述的结果。

#7


This thread may be a bit older, but since this still is a problem nowadays, I thought I’d propose a new solution for backing up Eclipse.

这个线程可能有点旧,但由于现在这仍然是一个问题,我想我会提出一个新的解决方案来备份Eclipse。

  • At http://profiles.yatta.de you can download the Yatta Eclipse Launcher. You can use it to save your Eclipse and workspace setup.

    在http://profiles.yatta.de,您可以下载Yatta Eclipse Launcher。您可以使用它来保存Eclipse和工作区设置。

  • After installation, the Launcher will discover your existing Eclipse installations and workspaces.

    安装后,Launcher将发现您现有的Eclipse安装和工作区。

  • Click the Upload & Share button (the blue one) on the right of the entry you want to back up.

    单击要备份的条目右侧的“上载和共享”按钮(蓝色按钮)。

(You won’t actually “share” your Eclipse or workspace with anyone. You’ll just upload a setup file with your metadata that only you have access to yourself . You could share this later, but you can also just use it as a backup).

(您实际上不会与任何人共享您的Eclipse或工作区。您只需上传一个包含元数据的设置文件,只有您可以访问自己。您可以稍后分享,但您也可以将其用作备用)。

If you do that, you’ll be able to re-setup your IDE really fast if you ever have a fragged workspace or Eclipse installation.

如果您这样做,如果您有一个碎片工作区或Eclipse安装,您将能够非常快速地重新设置IDE。

#8


I know this sounds obvious, but if I'm writing code for a living I would be sure to do a full backup weekly, with corresponding incremental backups daily.

我知道这听起来很明显,但如果我以编写代码为生,我肯定会每周进行一次完整备份,每天都会进行相应的增量备份。

Simple and easy recovery.

简单易用的恢复。

For a simple way to backup your eclipse directory and assuming your using Linux, you could use rsync.

有关备份eclipse目录并假设使用Linux的简单方法,可以使用rsync。

rsync -ar <eclipse-dir> <backup-eclipse-dir>

rsync -ar

You can put this in cron and have it backup your files automatically. It will only copy over the changed files to your backup-eclipse-dir on subsequent runs.

您可以将它放在cron中并让它自动备份您的文件。它只会在后续运行时将已更改的文件复制到backup-eclipse-dir。

#9


In my case only removing org.eclipse.e4.workbench directory (under .metadata/.plugins) and restarting Eclipse solved the problem.

在我的情况下,只删除org.eclipse.e4.workbench目录(在.metadata / .plugins下)并重新启动Eclipse解决了这个问题。

#10


None of the above worked for me. But what actually worked was deleting all *.snap files from my workspace. This also preserves almost all settings including imported projects. Make sure to back up the workspace before trying it though!!!

以上都不适合我。但实际工作的是从我的工作区删除所有* .snap文件。这也保留了几乎所有设置,包括导入的项目。确保在尝试之前备份工作区!

#11


Remove a file with .dat extension in workspace/.metadata/.plugins/org.eclipse.wst.jsdt.core/ and then close eand open eclipse, maybe you cannot close eclipse, force it, with pkill -f eclipse if you are on linux or similar.

删除工作区/ .metadata / .plugins / org.eclipse.wst.jsdt.core中扩展名为.dat的文件,然后关闭eand open eclipse,也许你不能关闭eclipse,强制它,如果你是pkill -f eclipse在linux或类似的。

This solution avoid to import all of existents projects.

此解决方案避免导入所有exates项目。

#12


I also experienced an issue like this, my workspace was corrupted and didn't do all the important things anymore.

我也经历过这样的问题,我的工作区已损坏,并且不再执行所有重要的事情。

For some reason, I had a corrupt resource on one of my projects. It didn't show up in the package tree, but it did show in the error log in Eclipse as

出于某种原因,我的一个项目有一个腐败的资源。它没有显示在包树中,但它确实在Eclipse的错误日志中显示为

Error while creating a link for external folder X:\somefolder

创建外部文件夹X的链接时出错:\ somefolder

After checking every project (because the error didn't point to one), I indeed found this resource in one of the build paths (in Configure Build Path menu it did show an error icon!) and deleted it.

在检查每个项目之后(因为错误没有指向一个),我确实在其中一个构建路径中找到了这个资源(在Configure Build Path菜单中,它确实显示了一个错误图标!)并将其删除。

See Eclipse (Kepler) Workspace acting weird (type hierarchy, searching for references not working) for a wider description of my issue if you're experiencing something similar.

如果您遇到类似的问题,请参阅Eclipse(Kepler)工作空间行为很奇怪(类型层次结构,搜索不起作用的引用)以获得更广泛的问题描述。

Posted this for future developers to reference.

发布此内容供以后的开发人员参考。

#13


deleting below file helped me solve my eclipse start up issue. Perforce plugin has always troubled me especially when my machine reboots, next time eclipse tries to recover workspace and craps out.

删除下面的文件帮我解决了我的eclipse启动问题。 Perforce插件总是困扰我,特别是当我的机器重新启动时,下次eclipse试图恢复工作区并疯狂。

workspace/.metadata/.plugins/org.eclipse.core.resources/.snap

For your reference, Error I was getting: org.eclipse.core.runtime.CoreException: Plug-in com.perforce.team.ui was unable to load class com.perforce.team.ui.UITeamProvider.

供您参考,错误我得到:org.eclipse.core.runtime.CoreException:插件com.perforce.team.ui无法加载类com.perforce.team.ui.UITeamProvider。

#14


In my case, it was not the workspace that was broken but Eclipse itself. Even though it seemed like workspace is broken (the same error dialog, etc.), all I had to do was reinstall Eclipse and point it to the old workspace. You can't really repair a broken workspace if it is the workspace that is broken but you can do so just for good measure, maybe it'll work.

在我的例子中,它不是被破坏的工作区而是Eclipse本身。即使看起来像工作区被破坏(相同的错误对话框等),我所要做的就是重新安装Eclipse并将其指向旧工作区。你不能真正修复一个破碎的工作区,如果它是破碎的工作区,但你可以这样做只是为了好的措施,也许它会工作。

#15


If the workspace is not that big you could backup to say dropbox as a private locked folder.

如果工作区不是那么大,您可以备份将Dropbox称为私有锁定文件夹。