Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven : error in opening zip file when running maven

Tags:

maven

[ERROR] error: error reading C:\Users\suresh\.m2\repository\org\jdom\jdom\1.1\jdom-1.1.jar; error in opening zip file
[ERROR] error: error reading C:\Users\suresh\.m2\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar; error in opening zip file
[ERROR] error: error reading C:\Users\suresh\.m2\repository\org\apache\cxf\cxf-rt-bindings-http\2.2.1\cxf-rt-bindings-http-2.2.1.jar; error in opening zip file
[ERROR] error: error reading C:\Users\suresh\.m2\repository\org\codehaus\jra\jra\1.0-alpha-4\jra-1.0-alpha-4.jar; error in opening zip file
[ERROR] error: error reading C:\Users\suresh\.m2\repository\org\apache\cxf\cxf-api\2.2.1\cxf-api-2.2.1.jar; error in opening zip file
[ERROR] error: error reading C:\Users\suresh\.m2\repository\org\apache\cxf\cxf-common-utilities\2.2.1\cxf-common-utilities-2.2.1.jar; error in opening zip file
[INFO] 44 errors

How to resolve this error while running mvn clean install?

And I see that, starting from servlet-api, no packages are being created inside the local repository on my disk.

like image 444
Pawan Avatar asked Sep 29 '11 15:09

Pawan


4 Answers

Probably, contents of the JAR files in your local .m2 repository are HTML saying "301 Moved Permanently". It seems that mvn does not handle "301 Moved Permanently" properly as expected. In such a case, download the JAR files manually from somewhere (the central repository, for example) and put them into your .m2 repository.

See also:

asm-3.1.jar; error in opening zip file
http://darutk-oboegaki.blogspot.jp/2012/07/asm-31jar-error-in-opening-zip-file.html

like image 156
Takahiko Kawasaki Avatar answered Nov 03 '22 23:11

Takahiko Kawasaki


This error sometimes occurs. The files becomes corrupt. A quick solution thats works for me, is:

  • Go to your local repository (in general /.m2/) in your case I see that is C:\Users\suresh.m2)
  • Search for the packages that makes conflicts (in general go to repository/org) and delete it
  • Try again to install it

With that you force to get the actual files

good luck with that!

like image 25
Darkaico Avatar answered Nov 04 '22 01:11

Darkaico


Try to remove your repository in /.m2/repository/ and then do a mvn clean install to download the files again.

like image 39
Shilpa Avatar answered Nov 03 '22 23:11

Shilpa


I had the same problem but previous solutions not work for me. The only solution works for me is the following URL.

https://enlightensoft.wordpress.com/2013/01/15/maven-error-reading-error-in-opening-zip-file/

[EDIT]

Here I explain more about it

Suppose you got an error like below

[ERROR] error: error reading C:\Users\user\.m2\repository\org\jdom\jdom\1.1\jdom-1.1.jar; error in opening zip file

Then you have to follow these steps.

  1. First, delete the existing jar C:\Users\user\.m2\repository\org\jdom\jdom\1.1\jdom-1.1.jar
  2. Then you have to manually download relevant jar from Maven central repository. You can download from this link here
  3. After that, you have to copy that downloaded jar into the previous directory.C:\Users\user\.m2\repository\org\jdom\jdom\1.1\

Then you can build your project using mvn clean install

hope this will help somebody.

like image 13
Buddhi Avatar answered Nov 04 '22 00:11

Buddhi