If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Monday, July 12, 2010

finding corrupt jars in maven repository

I use cygwin (a linux emulator) as one of my favourite development tools. And once again cygwin comes to the rescue for finding corrupt jars.

Make sure you have unzip/zip installed for cygwin and then you can do the following from the command line:

nxp10009@NLVEHVBE01NB13D /cygdrive/c/Documents and Settings/nxp10009/.m2/repository
$ find . -name "*jar" | xargs -L 1 zip -T | grep error | grep invalid

zip error: Zip file structure invalid (./javax/mail/mail/1.4/mail-1.4.jar)
zip error: Zip file structure invalid (./org/apache/axis2/axis2-adb/1.4.1/axis2-adb-1.4.1.jar)
zip error: Zip file structure invalid (./org/apache/axis2/axis2-kernel/1.4.1/axis2-kernel-1.4.1.jar)
zip error: Zip file structure invalid (./org/apache/geronimo/specs/geronimo-stax-api_1.0_spec/1.0.1/geronimo-stax-api_1.0_spec-1.0.1.jar)
You should try to delete those corrupt jars from your repository and download them again.

3 comments:

  1. And for those like me who couldn't see anything displayed (thx Firebug), the command is:

    find . -name "*jar" | xargs -L 1 zip -T | grep error | grep invalid

    ReplyDelete
  2. I adjusted the output to be wrapped in a pre tag so now it should be readable for everybody ;-)

    ReplyDelete
    Replies
    1. Other than on low resolution mobile devices where it disappears off the right edge of the screen, and for some reason scrolling is disabled... (Aside: why do so many web sites with responsive designs disable horizontal scrolling on mobile?)

      Delete