`
Josh_Persistence
  • 浏览: 1645748 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类

Maven - error in opening zip file

阅读更多

在一个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 the error
错误:读取 F:\.m2\repository\javax\jms\jms\1.1\jms-1.1.jar 时出错; error in opening zip file 
错误:读取 F:\.m2\repository\com\sun\jdmk\jmxtools\1.2.1\jmxtools-1.2.1.jar 时出错; error in opening zip file 
错误:读取 F:\.m2\repository\com\sun\jmx\jmxri\1.2.1\jmxri-1.2.1.jar 时出错; error in opeing zip file 
3 错误

 

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

 

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

 

0
3
分享到:
评论

相关推荐

    aspectjweaver-1.9.6.jar报错error in opening zip file,下载后替换

    java: 读取D:\Develop\maven\repository\org\aspectj\aspectjweaver\1.9.6\aspectjweaver-1.9.6.jar时出错; error in opening zip file 提示jar出问题,找到此处,删除重新下载,但是jar依旧是损坏状态

    jackson-datatype-jsr310-2.11.4-API文档-中英对照版.zip

    包含翻译后的API文档:jackson-datatype-jsr310-2.11.4-javadoc-API文档-中文(简体)-英语-对照版.zip; Maven坐标:com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.4; 标签:fasterxml、jackson、...

    aspose-words-15.8.0-jdk16.zip

    标题中的"aspose-words-15.8.0-jdk16.zip"是指Aspose.Words的一个特定版本,这是Aspose公司提供的一个强大的文档处理库。Aspose.Words允许开发者在Java环境下处理Microsoft Word文档,包括创建、读取、编辑、转换和...

    jjwt-0.11.2.zip

    在使用jjwt-0.11.2.zip这个压缩包时,首先需要了解JWT的基本结构。JWT由三部分组成:头部(Header)、负载(Payload)和签名(Signature)。头部通常包含令牌类型(JWT)和加密算法;负载中存储声明,如用户ID、角色...

    slf4j-api-1.7.30.jar

    通过`LoggerFactory.getLogger()`方法,开发者可以获取一个与当前类关联的`Logger`实例,然后调用`info()`, `debug()`, `warn()`, `error()`等方法进行不同级别的日志记录。这些方法在运行时会根据配置的实现(如...

    使用HikariCP时需要的jar

    1. 如果你使用Maven或Gradle构建系统,可以在pom.xml或build.gradle文件中添加相应的依赖项。 2. 对于非构建系统的项目,你可以将这些JAR文件复制到项目的类路径(classpath)下,例如lib目录,并确保IDE能够正确...

    pentaho-aggdesigner-algorithm-5.1.5-jhyde.tar

    jar放入D根目录执行: 以下命令加入本地maven库 mvn install:install-file -DgroupId=org.pentaho -DartifactId=pentaho-aggdesigner-algorithm -Dversion=5.1.5-jhyde -Dpackaging=jar -Dfile=D:/pentaho-...

    analyzer-2012_u6.jar

    描述中提到的错误信息"error in opening zip file"暗示了在尝试打开或运行analyzer-2012_u6.jar时遇到了问题。这可能是由于多种原因导致的,例如文件损坏、不完整的下载、缺少依赖的库,或者是使用了不兼容的Java...

    Eclipse错误解决办法

    如果Eclipse中出现错误提示,如“error in opening zip file”,表示Maven可能下载了不完整的JAR文件。要修复此问题,需手动删除`.m2\repository`目录下的问题文件,然后重新构建项目以触发Maven重新下载正确的JAR...

    java解压缩rar文件

    System.out.println("Error opening RAR file: " + rar.lastErrorText()); return; } ``` 3. **遍历RAR文件中的所有条目**:使用`rar.GetFirstEntry()`获取第一个条目,然后用`rar.GetNextEntry()`循环遍历所有...

Global site tag (gtag.js) - Google Analytics