Maven: error opening zip file when maven starts

[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 fix this error when running mvn clean install ?

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

+56
maven
Sep 29 '11 at 15:53
source share
13 answers

The contents of the JAR files in your local .m2 repository are probably HTML in which "301 has been moved constantly." It seems that mvn does not handle "301 Moved Permanentently" properly, as expected. In this case, manually upload the JAR files somewhere (

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

+66
Jul 13 2018-12-12T00:
source share

This error sometimes occurs. Files become damaged. A quick solution that works for me is:

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

With this you force the actual files

Good luck with that!

+48
Jan 04 2018-12-12T00:
source share

Try deleting the repository in /.m2/repository/ and then run mvn clean install to download the files again.

+22
Jan 31 '14 at 10:14
source share

I had the same problem, but previous solutions do 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 will explain more about this.

Suppose you get an error as shown 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 must follow these steps.

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

Then you can build your project using mvn clean install

I hope this helps someone.

+8
Nov 21 '17 at 4:19 on
source share
  • go to .m2/repository and delete the conflicting files
  • mvn -U clean install
+6
May 31 '14 at 21:26
source share

I had a similar problem. The correction was a mixture of both. I had a problem with asm-3.1 (as mentioned in a blog post related to Takahiko. This jar was damaged. I needed to manually get the jar from the maven central repository . After uninstalling and retrying, I again got a damaged jar. Still failed in asm-parent, which was a POM file containing HTML code with code 301. Again, he himself demanded to manually obtain the file.You might want to check what XML data settings to see if you are configured to another repository, such as a local Nexus server.

When the correct way to get a new one fails, take it manually.

+5
Mar 07 '13 at 15:17
source share

This error can occur when your connection is interrupted while loading your dependencies. Delete the corresponding repository folder and run the following command again to download a new copy of the damaged file.

 mvn clean install 
+5
Jan 19 '15 at 4:55
source share
  1. I deleted the jar downloaded by Maven
  2. manually download the jar from google
  3. put the jar in the local repository instead of the remote one.

This solved my problem.

Hope help

+2
Jun 08 '18 at 6:55
source share

I also ran into the same problem, my problem is resolved. Decision:

According to the error information, to find the corresponding jar in the maven repository and delete. Then run the mvn install command after uninstall.

+1
May 19 '14 at 6:51
source share

Unfortunately, I found a simple workaroud to this question. Running Maven with the -X option causes it to try other servers to download the source code. Instead of HTML garbage, some jar files have the right content inside.

 mvn clean install -X > d:\log.txt 

And in the log file you will find the following messages:

 Downloading: https://repository.apache.org/content/groups/public/org/apache/axis2/mex/1.6.1-wso2v2/mex-1.6.1-wso2v2-impl.jar [DEBUG] Writing resolution tracking file D:\wso2_local_repository\org\apache\axis2\mex\1.6.1-wso2v2\mex-1.6.1-wso2v2-impl.jar.lastUpdated Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/axis2/mex/1.6.1-wso2v2/mex-1.6.1-wso2v2-impl.jar 

You see, Maven switched repository.apache.org to maven.wso2.org when he encountered a download problem. So now the following error:

 [ERROR] error: error reading D:\wso2_local_repository\org\apache\axis2\mex\1.6.1-wso2v2\mex-1.6.1-wso2v2-impl.jar; error in opening zip file 
0
Jul 29 '14 at 10:02
source share

For me, I have to change the .m2 repository in the settings.xml file with a different one, because on Mac maven cannot create a folder that starts with a period (.)

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

 <localRepository>../repo</localRepository> 

do not forget to change it in your IDE, in eclipse go to: Windows> Preferences> Maven> User Settings> Global Settings and go to your settings.xml.

clean up your project.

Hope this helps you.

0
Oct 25 '17 at 20:36 on
source share

This error occurs due to file corruption. But we do not need to delete the entire .m2 folder. Instead, find which JAR files are corrupted by looking at the error message in the console. And delete only those folders that contain these JAR files .

As 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-client bindings
  4. C: \ Users \ Suresh \ .m2 \ repository \ org \ Codehaus \ Jura \ JRA
  5. C: \ Users \ Suresh \ .m2 \ repository \ org \ Apache \ CXF \ CXF-api
  6. C: \ Users \ Suresh \ .m2 \ repository \ org \ Apache \ CXF \ CXF-common -U utilities

Delete these folders. Then run.

mvn -U clean install

0
Feb 07 '19 at 4:34
source share

This problem is a pain in my $$, I have this problem on my Mac if I run

 mvn clean install | grep "error reading" 
 [ERROR] error reading /Users/ducnguyen/.m2/repository/org/apache/velocity/velocity/1.7/velocity-1.7.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/commons-net/commons-net/3.3/commons-net-3.3.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/org/apache/commons/commons-lang3/3.0/commons-lang3-3.0.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.54/bcprov-jdk15on-1.54.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/javax/mail/mail/1.4/mail-1.4.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/org/apache/pdfbox/pdfbox/2.0.0/pdfbox-2.0.0.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/com/itextpdf/itextpdf/5.5.10/itextpdf-5.5.10.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/org/slf4j/slf4j-api/1.7.24/slf4j-api-1.7.24.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/com/aspose/aspose-pdf/11.5.0/aspose-pdf-11.5.0.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/org/apache/velocity/velocity/1.7/velocity-1.7.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/commons-net/commons-net/3.3/commons-net-3.3.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/org/apache/commons/commons-lang3/3.0/commons-lang3-3.0.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.54/bcprov-jdk15on-1.54.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/javax/mail/mail/1.4/mail-1.4.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/org/apache/pdfbox/pdfbox/2.0.0/pdfbox-2.0.0.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/com/itextpdf/itextpdf/5.5.10/itextpdf-5.5.10.jar; error in opening zip file [ERROR] error reading /Users/ducnguyen/.m2/repository/org/slf4j/slf4j-api/1.7.24/slf4j-api-1.7.24.jar; error in opening zip file 

Removing all damaged libraries is the only solution.

Therefore, I want to delete them all at once.

 mvn clean install | grep "error reading" | awk '{print "rm " $4 | "/bin/sh" }' 

The command needs AWK to take the libPath row from column $ 4

Then repeat

 mvn clean install 
0
Feb 20 '19 at 3:28
source share



All Articles