开发者

Project was not built due to

I'm working on an Android App using the Android SDK for Eclipse as well as the Egit plug in for github.

Recently I've encountered an error while trying to build the project after attempting to merge with the (remote) master. I have this error listed in the Problems window:

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."

In my Error Log I also have from a previous 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)

and:

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)

I've tried searching for some possible solutions but haven't been able to find anything of use.

I came across this problem after seeing an error marker next to my project name but had no markers for any of my classes.

I first searched 开发者_JS百科possible solutions to that problem and most of them explained to do a Project > Clean which is when my build errors showed up in the log.

Thanks.


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

This will be due to the presence of a file: ... \.git\index-lock - it should have file size 0

EGit thinks that another git client is performing an exclusive action. However, I have found that when EGit throws an exception (from an earlier operation) it fails to clean up its own lock file!

To solve, check that no git clients are accessing your local git repo (maybe close Eclipse too) and simply delete it.

Other thoughts:

  • Upgrade EGit! Later versions are better than ~9 months ago when the question was posted. (I had issues with an "Eclipse link folder" inside a git working directory. EGit can still crash because of that - but now just on specific git actions rather than practically every Java refactoring action!)

  • On windows, multiple git clients can clobber each other in nasty ways, since Windows file-locking is more 'exclusive' than on Linux (by default anyway - when calling the "usual" C/Java functions)

Aside: actually the later problem is so bad that I've switched to command-line almost exclusively, and just 'attach' EGit (Team -> Share Project) temporarily just for git annotate! This also saves a lot of RAM. It's a shame, because EGit seems quite nicely integrated. At least attaching / detaching is very quick.


In such a case, I would switch to a command line interface, and check:

  • git status within the project
  • make sure the merge has been completed (check if there isn't some merge conflicts)
  • clone the repo in a new directory
  • import said project in a new workspace, to see if it can be rebuild there.

That is more a workaround than an explanation of what is actually going for your issue, but at least that would allow to move on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜