Maven : error in opening zip file when running mav

2020-01-26 05:56发布

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

标签: maven
14条回答
The star\"
2楼-- · 2020-01-26 06:30

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!

查看更多
叛逆
3楼-- · 2020-01-26 06:30

I had a similar problem as well. The fix was a mix of both. I had a problem with asm-3.1 (as mentioned in the blog post linked by Takahiko. That jar was corrupt. I needed to manually get the jar from the maven central repository. Removing it and retrying just got the corrupt jar again. It then still failed on the asm-parent, which was a POM file containing the HTML with a 301. Again, it required manually getting the file myself. You may want to check what settings XML to see if you're set to a different repository, such as a local nexus server.

When the proper way to get the new one fails, manually grab it yourself.

查看更多
Luminary・发光体
4楼-- · 2020-01-26 06:31

This error occurs because of some file corruption. But we don't need to delete whole .m2 folder. Instead find which jar files get corrupted by looking at the error message in the console. And delete only the folders which contains those jar files.

Like in the question :

  1. C:\Users\suresh\.m2\repository\org\jdom\jdom\
  2. C:\Users\suresh\.m2\repository\javax\servlet\servlet-api\
  3. C:\Users\suresh\.m2\repository\org\apache\cxf\cxf-rt-bindings-http
  4. C:\Users\suresh\.m2\repository\org\codehaus\jra\jra
  5. C:\Users\suresh\.m2\repository\org\apache\cxf\cxf-api
  6. C:\Users\suresh\.m2\repository\org\apache\cxf\cxf-common-utilities

Delete these folders. Then run.

mvn clean install -U

查看更多
冷血范
5楼-- · 2020-01-26 06:32
  1. go to the .m2/repository and delete the conflicting files
  2. mvn -U clean install
查看更多
爷的心禁止访问
6楼-- · 2020-01-26 06:32

For me I should change the .m2 repo in the settings.xml file with another one because in Mac maven can't create a folder that start with point(.)

to solve that, open your maven/version/conf/settings.xml and specify the location of your repo folder like this :

<localRepository>../repo</localRepository>

don't forget to change it also in your IDE, in eclipse go to : Windows > Preferences > Maven > User Settings > Global Settings, and navigate to your settings.xml.

clean install your project.

hope this will help you.

查看更多
该账号已被封号
7楼-- · 2020-01-26 06:41

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

查看更多
登录 后发表回答