In a Maven project, sometimes a exception like (Error in opening zip file) is reported when executing commands such as MVN packaging, deployment, compiling, such as MVN clean install-dskiptests-u. For example, in one of my projects, I reported the following two exception
The first of the exception:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
3.2:compile (Default-compile) on project validator-rest:compilation failure
[ERROR] Failure executing Javac, but could not parse the error:
[ERROR]: Read C:\maven-repo\swang\ebox\org\hibernate\hibernate-entitymanage
Error in R\4.2.4.final\hibernate-entitymanager-4.2.4.final.jar; error in opening Z
IP file
[ERROR] 1 errors
[ERROR], [Help 1]
Org.apache.maven.lifecycle.LifecycleExecutionException:Failed to execute goal O
Rg.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (Default-compile) on
Project Validator-rest:compilation Failure
Failure executing Javac, but could not parse the error:
error: Read c:\maven-repo\swang\ebox\org\hibernate\hibernate-entitymanager\4.2.4.
error in opening zip file when Final\hibernate-entitymanager-4.2.4.final.jar
1 Error
At Org.apache.maven.lifecycle.internal.MojoExecutor.execute (mojoexecutor
. java:213)
At Org.apache.maven.lifecycle.internal.MojoExecutor.execute (mojoexecutor
. java:153)
At Org.apache.maven.lifecycle.internal.MojoExecutor.execute (mojoexecutor
. java:145)
At Org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
CT (lifecyclemodulebuilder.java:84)
At Org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
CT (lifecyclemodulebuilder.java:59)
At Org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ILD (lifecyclestarter.java:183)
At Org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LIFECYCL
estarter.java:161)
At Org.apache.maven.DefaultMaven.doExecute (defaultmaven.java:320)
At Org.apache.maven.DefaultMaven.execute (defaultmaven.java:156)
At Org.apache.maven.cli.MavenCli.execute (mavencli.java:537)
At Org.apache.maven.cli.MavenCli.doMain (mavencli.java:196)
At Org.apache.maven.cli.MavenCli.main (mavencli.java:141)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.
JAVA:39)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:25)
At Java.lang.reflect.Method.invoke (method.java:597)
At org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (launcher.java:290)
At Org.codehaus.plexus.classworlds.launcher.Launcher.launch (launcher.java:230)
At Org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (launcher.java:409)
At Org.codehaus.plexus.classworlds.launcher.Launcher.main (launcher.java:352)
caused by:org.apache.maven.plugin.CompilationFailureException:Compilation failure
Failure executing Javac, but could don't parse the error: Error: Read c:\maven-repo\swang\ebox\org\hibernate\ Error in opening zip file1 errors at Hibernate-entitymanager\4.2.4.final\hibernate-entitymanager-4.2.4.final.jar Org.apache.maven.plugin.AbstractCompilerMojo.execute (Abstractcompiler
mojo.java:656)
At Org.apache.maven.plugin.CompilerMojo.execute (compilermojo.java:128)
At Org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (Default
BUILDPLUGINMANAGER.JAVA:101)
At Org.apache.maven.lifecycle.internal.MojoExecutor.execute (mojoexecutor
. java:209) ... More
[ERROR]
[ERROR]
[ERROR] For more information on the errors and possible solutions, please REA
D The following articles:
[ERROR] [Help 1] Http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
Eption
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals>-rf:validator-rest
Solution: In Maven's pom file, add the following dependency to solve the problem:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
A second exception:
[WARNING] POM for ' javax.jms:jms:pom:1.1:compile ' is invalid.
It dependencies (if any) is not being available to the current build.
[WARNING] POM for ' com.sun.jdmk:jmxtools:pom:1.2.1:compile ' is invalid.
It dependencies (if any) is not being available to the current build.
[WARNING] POM for ' com.sun.jmx:jmxri:pom:1.2.1:compile ' is invalid.
...
Failure executing Javac, but could not parse theError:
Error: Error reading F:\.m2\repository\javax\jms\jms\1.1\jms-1.1.jar; errorinopeningzipfile
Error: Error reading F:\.m2\repository\com\sun\jdmk\jmxtools\1.2.1\jmxtools-1.2.1.jar; errorinopeningzip file
Error: Error reading F:\.m2\repository\com\sun\jmx\jmxri\1.2.1\jmxri-1.2.1.jar; errorinopeingzipfile
3 Error
The solution to this problem is to modify the pom.xml, changing the log4j version from 1.2.15 to 1.2.14.
Summary: This type of problem is generally due to the jar package conflict, or the dependency of the jar package, so when encountering such an error, you can start from this direction.
Original:s tolerance D in http://www.c n Forbidden 123.com/html/blogs/20130829/61031.htm
Maven-error in opening zip file