Search code examples
eclipseeclipse-pluginemf

How can I repair a damaged eclipse $HOME/.p2 repository?


I've been working through a long string of issues that apparently started when my Ubuntu VM ran out of disk space a couple of weeks ago. I was able to expand the virtual disk and get past that, but it appears that behind the scenes this caused Eclipse to somehow corrupt some jars in my "$HOME/.p2" repository. It was even a long struggle to figure out which jars were corrupted, as Eclipse would fail to install a new plugin, saying that a zip file was invalid, but the exception info wasn't saying which zip file was corrupted.

In any case, by connecting a debugger I was able to figure out which zip file was corrupted, in my "$HOME/.p2" tree, and a bug report I filed for the lack of info in the original exception was actually fixed almost immediately (in source at least).

I'm now left with a corrupted "$HOME/.p2" repo. I found five jar files that were not zero length, but both "jar tvf" and unzip -tq" reported errors on those five files (no other jars in the repo had this problem).

If it matters, this is the list of bad files:

$HOME/.p2/pool/plugins/org.eclipse.emf.mapping.ecore2ecore.editor_2.7.0.v20160201-0859.jar
$HOME/.p2/pool/plugins/org.eclipse.emf.mapping_2.9.0.v20160201-0859.jar
$HOME/.p2/pool/plugins/org.eclipse.emf.mapping.ecore2xml_2.9.0.v20160201-0859.jar
$HOME/.p2/pool/plugins/org.eclipse.emf.mapping.ecore2xml.ui_2.8.0.v20160201-0859.jar
$HOME/.p2/pool/plugins/org.eclipse.emf.mapping.ui_2.7.0.v20160201-0859.jar

It's unfortunate that this "$HOME/.p2" repo "feels" like the local Maven repo, at "$HOME/.m2/repository". With that, you can just delete bad files and the next Maven build will restore them. I tried removing the bad files in question (moving them somewhere, just in case), but that just changes the error message Eclipse gives me from a "bad format" to "file not found".

Am I going to have to find these specific jars somewhere, or is there some easier way to get Eclipse to repair this repository?


Solution

  • Question answered here by Eike Stepper: https://www.eclipse.org/forums/index.php/mv/msg/1074901/1723920/#msg_1723920

    (please don't assign credits to me as Eike is the Author)