1

我正在使用适用于 Eclipse 的 Android SDK 以及适用于 github 的 Egit 插件开发一个 Android 应用程序。
最近我在尝试与 (remote) 合并后尝试构建项目时遇到错误master。我在“问题”窗口中列出了此错误:

The project was not built due to "Error updating cache during move/delete.
The resource cannot be moved, renamed or deleted due to an internal error."

在我的错误日志中,我也有以前的Project > Clean

JavaBuilder handling ImageBuilderInternalException while building: Project
org.eclipse.core.internal.resources.ResourceException: Problems encountered while deleting resources.
    at org.eclipse.core.internal.resources.Resource.delete(Resource.java:737)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.cleanOutputFolders(BatchImageBuilder.java:114)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:46)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:254)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:173)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Contains: Error updating cache during move/delete.
The resource cannot be moved, renamed or deleted due to an internal error.
java.io.IOException: Cannot lock C:\Users\Jessbro\Project\.git\index
    at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:187)
    at org.eclipse.jgit.lib.Repository.lockDirCache(Repository.java:932)
    at org.eclipse.egit.core.GitMoveDeleteHook.deleteFile(GitMoveDeleteHook.java:58)
    at org.eclipse.team.internal.core.MoveDeleteManager.deleteFile(MoveDeleteManager.java:50)
    at org.eclipse.core.internal.resources.Resource.unprotectedDelete(Resource.java:1763)
    at org.eclipse.core.internal.resources.Resource.delete(Resource.java:724)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.cleanOutputFolders(BatchImageBuilder.java:114)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:46)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:254)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:173)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

和:

JavaBuilder handling CoreException while cleaning: Project
org.eclipse.core.internal.resources.ResourceException: Problems encountered while deleting resources.
    at org.eclipse.core.internal.resources.Resource.delete(Resource.java:737)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.cleanOutputFolders(BatchImageBuilder.java:114)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.clean(JavaBuilder.java:291)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:218)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:360)
    at org.eclipse.core.internal.resources.Project$1.run(Project.java:523)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1782)
    at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:502)
    at org.eclipse.core.internal.resources.Project.build(Project.java:94)
    at org.eclipse.ui.internal.ide.dialogs.CleanDialog.doClean(CleanDialog.java:312)
    at org.eclipse.ui.internal.ide.dialogs.CleanDialog$1.runInWorkspace(CleanDialog.java:154)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Contains: Error updating cache during move/delete.
The resource cannot be moved, renamed or deleted due to an internal error.
java.io.IOException: Cannot lock C:\Users\Jessbro\Project\.git\index
    at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:187)
    at org.eclipse.jgit.lib.Repository.lockDirCache(Repository.java:932)
    at org.eclipse.egit.core.GitMoveDeleteHook.deleteFile(GitMoveDeleteHook.java:58)
    at org.eclipse.team.internal.core.MoveDeleteManager.deleteFile(MoveDeleteManager.java:50)
    at org.eclipse.core.internal.resources.Resource.unprotectedDelete(Resource.java:1763)
    at org.eclipse.core.internal.resources.Resource.delete(Resource.java:724)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.cleanOutputFolders(BatchImageBuilder.java:114)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.clean(JavaBuilder.java:291)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:218)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:360)
    at org.eclipse.core.internal.resources.Project$1.run(Project.java:523)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1782)
    at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:502)
    at org.eclipse.core.internal.resources.Project.build(Project.java:94)
    at org.eclipse.ui.internal.ide.dialogs.CleanDialog.doClean(CleanDialog.java:312)
    at org.eclipse.ui.internal.ide.dialogs.CleanDialog$1.runInWorkspace(CleanDialog.java:154)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

我尝试寻找一些可能的解决方案,但找不到任何有用的东西。
在我的项目名称旁边看到一个错误标记但我的任何类都没有标记后,我遇到了这个问题。
我首先搜索了该问题的可能解决方案,其中大多数解释说Project > Clean当我的构建错误出现在日志中时。
谢谢。

4

2 回答 2

1

The resource cannot be moved, renamed or deleted due to an internal error. java.io.IOException: Cannot lock C:\Users\Jessbro\Project\.git\index

这将是由于文件的存在: ... \.git\index-lock- 它的文件大小应为 0

EGit 认为另一个 git 客户端正在执行独占操作。但是,我发现当 EGit 抛出异常(来自早期操作)时,它无法清理自己的锁定文件!

要解决这个问题,请检查是否没有 git 客户端正在访问您的本地 git 存储库(也可能关闭 Eclipse)并简单地删除它。

其他想法:

  • 升级 EGit!后来的版本比大约 9 个月前发布问题时要好。(我在 git 工作目录中遇到了“Eclipse 链接文件夹”的问题。EGit 仍然可能因此而崩溃 - 但现在只是针对特定的 git 操作,而不是几乎每个 Java 重构操作!)

  • 在 Windows 上,多个 git 客户端可能会以令人讨厌的方式相互破坏,因为 Windows 文件锁定比 Linux 上更“独占”(无论如何默认情况下 - 当调用“通常”的 C/Java 函数时)

旁白:实际上后面的问题太糟糕了,我几乎完全切换到命令行,只是暂时“附加”EGit(团队->共享项目)只是为了git annotate!这也节省了大量的 RAM。很遗憾,因为 EGit 似乎集成得很好。至少连接/分离非常快。

于 2012-01-27T22:03:54.000 回答
0

在这种情况下,我会切换到命令行界面,并检查:

  • git status项目内
  • 确保合并已完成(检查是否没有一些合并冲突)
  • 在新目录中克隆 repo
  • 在新的工作区中导入所述项目,看看是否可以在那里重建。

这更像是一种解决方法,而不是解释您的问题的实际情况,但至少可以继续前进。

于 2011-04-13T04:09:34.287 回答