在一个maven工程中,有时执行mvn打包,部署,编译等命令,例如mvn clean install -DskipTests -U等命令时,会报类似(error in opening zip file)的Exception,例如在我的其中一个项目中,就报了如下的两个Exception

第一个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] 错误:读取 c:\maven-repo\swang\ebox\org\hibernate\hibernate-entitymanage
r\4.2.4.Final\hibernate-entitymanager-4.2.4.Final.jar 时出错;error in opening z
ip file
[ERROR] 1 错误
[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:
错误:读取 c:\maven-repo\swang\ebox\org\hibernate\hibernate-entitymanager\4.2.4.
Final\hibernate-entitymanager-4.2.4.Final.jar 时出错;error in opening zip file
1 错误

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 not parse the error:错误:读取
c:\maven-repo\swang\ebox\org\hibernate\hibernate-entitymanager\4.2.4.Final\hibernate-entitymanager-4.2.4.Final.jar
时出错;error in opening zip file1 错误 at
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) ... 19 more
[ERROR]
[ERROR]
[ERROR] For more information about 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

解决方案:在maven的pom 文件中,加入如下的dependency,就解决了该问题:

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>

第二个Exception:

[WARNING] POM for 'javax.jms:jms:pom:1.1:compile' is invalid.

Its dependencies (if any) will NOT be available to the current build.
[WARNING] POM for 'com.sun.jdmk:jmxtools:pom:1.2.1:compile' is invalid.

Its dependencies (if any) will NOT be 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:
错误:读取 F:\.m2\repository\javax\jms\jms\1.1\jms-1.1.jar 时出错;errorinopeningzipfile
错误:读取 F:\.m2\repository\com\sun\jdmk\jmxtools\1.2.1\jmxtools-1.2.1.jar 时出错;errorinopeningzipfile
错误:读取 F:\.m2\repository\com\sun\jmx\jmxri\1.2.1\jmxri-1.2.1.jar 时出错;errorinopeingzipfile
3 错误

这个问题的解决方案还是修改pom.xml,将 log4j 的版本从1.2.15改成1.2.14。

总结:该类问题一般都是因为jar包的冲突,或者jar包的依赖引起来的,所以碰到这类Error时,可以从这个方向入手。

原文:http://www.c内s容d违n禁123.com/html/blogs/20130829/61031.htm

Maven - error in opening zip file的更多相关文章

  1. maven install 读取jar包时出错;error in opening zip file

    错误信息: [INFO] ------------------------------------------------------------------------ [ERROR] Failed ...

  2. maven时候Embedded error: error in opening zip file

    maven时候Embedded error: error in opening zip file 用 mvn clean install -Dmaven.test.skip=true -Denv=re ...

  3. maven创建web报错Cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins:maven-compiler-plugin:maven-compiler-plugin:3.5.1:runtime Cause: error in opening zip file

    Cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins:maven-compiler-plugin:m ...

  4. spring boot tomcat 打本地包成war,通过Tomcat启动时出现问题: ZipException: error in opening zip file

    一个第三方公司提供spring boot 项目,直接启动是ok的, 但是打包成war,通过Tomcat启动,就出现 ZipException: error in opening zip file: 2 ...

  5. Tomcat启动报错:org.apache.catalina.LifecycleException: Failed to start component...java.util.zip.ZipException: error in opening zip file

    1.项目环境 IntelliJ IDEA2018.1.6 apache-tomcat-8.0.53 基于springboot开发的项目 maven3.5.3 2.出现问题 从svn同步下项目 启动to ...

  6. [java ] java.util.zip.ZipException: error in opening zip file

    严重: Failed to processes JAR found at URL [jar:file:/D:/tools/apache-tomcat-7.0.64_2/webapps/bbs/WEB- ...

  7. Eclipse中mvn install 报错error in opening zip file

    报错信息 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (de ...

  8. tomcat 启动项目时出现 ZipException: error in opening zip file

    错误情况 项目用 maven 打好 war 包后放到 tomcat 下,启动 tomcat,出现以下错误 3-Nov-2017 12:21:44.346 严重 [localhost-startStop ...

  9. [ERROR] error: error while loading <root>, error in opening zip file error: scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found.

    在家编译一个Apache的开源项目,在编译时遇到错误如下: error: error while loading <root>, error in opening zip file [ER ...

随机推荐

  1. PhpStrom弹窗License activation 报 this license BIG3CLIK6F has been cancelled 错误的解决。

    将“0.0.0.0 account.jetbrains.com”添加到hosts文件中

  2. Java android DES+Base64加密解密

    服务器与客户端加密解密传输, 中间遇到各种坑,客户端无论用AES还是DES解密时都会出现错误,后来才看到好多人说要用AES/DES加完密后还要BASE64加密,照做时发现android和java的Ba ...

  3. 基于django rest framework的mock server实践

    网上找了一下mock server的实现,发现python的基本都是基于flask来实现的,因最近在学django,就尝试用drf实现了下: A brief introduction of sui_m ...

  4. LCA【bzoj3364】 [Usaco2004 Feb]Distance Queries 距离咨询

    Description  奶牛们拒绝跑马拉松,因为她们悠闲的生活无法承受约翰选择的如此长的赛道.因此约翰决心找一条更合理的赛道,他打算咨询你.此题的地图形式与前两题相同.但读入地图之后,会有K个问题. ...

  5. Maximum Size Subarray Sum Equals k -- LeetCode

    Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If t ...

  6. luogu P1577 切绳子

    题目描述 有N条绳子,它们的长度分别为Li.如果从它们中切割出K条长度相同的 绳子,这K条绳子每条最长能有多长?答案保留到小数点后2位. 输入输出格式 输入格式: 第一行两个整数N和K,接下来N行,描 ...

  7. bin/...的访问被拒绝被拒绝的问题

    复制到bin.... 对路径bin/.... 的访问被拒绝出现这们的问题,把源码管理器中项目的Bin目录删除,重新获取就要以了

  8. 【Git】windows上git命令中文乱码的问题

    windows上git命令中文乱码的问题解决 1.打开git bash快捷方式启动 2.右键 options 3.进入text选项卡,选中中文 和UTF-8 4.应用 测试[中文正常显示] 尝试打开文 ...

  9. [置顶] docker--基础镜像和dockerfile

    制作基础镜像 注意:需要在CentOS6下操作 准备工作 yum -y install febootstrap 下载ISO镜像文件到服务器 mkdir /mnt/centos6/ mount -o l ...

  10. python定时执行方法

    1  time.sleep import time for i in range(5): print(i) time.sleep(10) 2 用shed import time import sche ...