maven install 仅在第二次尝试后抛出“打开 zip 文件时出错”

2024-04-08

我尝试在我的项目上运行 Maven install 并带有一些依赖项:

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.15</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.5.2</version>
</dependency>
<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>0.9.24</version>
</dependency>

<dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-core</artifactId>
   <version>3.3.2.GA</version>
</dependency>
<dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-annotations</artifactId>
   <version>3.4.0.GA</version>
</dependency>

我第一次跑步mvn install它运行得很好(建立成功) 但第二次(“在我对代码进行一些更改之后”)我尝试运行mvn install和maven抛出“打开zip文件时出错”。

[ERROR] error: error reading C:\Users\Idan\.m2\repository\javax\jms\jms\1.1\jms-         1.1.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\com\sun\jdmk\jmxtools\1.2.1\jmxtools-1.2.1.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\com\sun\jmx\jmxri\1.2.1\jmxri-1.2.1.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\ch\qos\logback\logback-classic\0.9.24\logback-classic-0.9.24.jar; error in opening zip file

but

如果我删除 日志4j, slf4j, 和 logback-classoc 依赖关系 运行maven install(构建成功) 返回 日志4j, slf4j, 和 logback-classic 依赖关系 运行 maven install 它运行得很好(构建成功)。

可能是什么问题?

Update:

好吧,我删除所有 .m2/repository 文件夹删除项目中的所有目标文件夹 然后我跑mvn install我得到

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building d 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/maven-surefire-plugin-2.7.1.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/maven-surefire-plugin-2.7.1.pom (10 KB at 28.9 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/surefire/surefire/2.7.1/surefire-2.7.1.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/surefire/surefire/2.7.1/surefire-2.7.1.pom (10 KB at 40.7 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-parent/18/maven-parent-18.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/maven-parent/18/maven-parent-18.pom (24 KB at 74.0 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/apache/8/apache-8.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/apache/8/apache-8.pom (14 KB at 43.3 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/maven-surefire-plugin-2.7.1.jar
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/maven-surefire-plugin-2.7.1.jar (29 KB at 50.1 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.pom (5 KB at 21.0 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.jar
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.jar (23 KB at 40.8 KB/sec)
[WARNING] The POM for log4j:log4j:jar:1.2.15 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.slf4j:slf4j-log4j12:jar:1.5.2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for ch.qos.logback:logback-classic:jar:0.9.24 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.hibernate:hibernate-core:jar:3.3.2.GA is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.hibernate:hibernate-annotations:jar:3.4.0.GA is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.hibernate:hibernate-commons-annotations:jar:3.3.0.ga is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.hibernate:hibernate-entitymanager:jar:3.4.0.GA is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for junit:junit:jar:3.8.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for postgresql:postgresql:jar:9.1-901.jdbc4 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ d ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ d ---
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-toolchain/1.0/maven-toolchain-1.0.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/maven-toolchain/1.0/maven-toolchain-1.0.pom (4 KB at 7.6 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-api/1.8.1/plexus-compiler-api-1.8.1.pom
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-api/1.8.1/plexus-compiler-api-1.8.1.pom (805 B at 3.4 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler/1.8.1/plexus-compiler-1.8.1.pom
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler/1.8.1/plexus-compiler-1.8.1.pom (4 KB at 11.9 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-components/1.1.18/plexus-components-1.1.18.pom
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-components/1.1.18/plexus-components-1.1.18.pom (6 KB at 20.7 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus/2.0.7/plexus-2.0.7.pom
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus/2.0.7/plexus-2.0.7.pom (17 KB at 57.6 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.pom
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.pom (6 KB at 10.4 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-manager/1.8.1/plexus-compiler-manager-1.8.1.pom
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-manager/1.8.1/plexus-compiler-manager-1.8.1.pom (713 B at 3.0 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-javac/1.8.1/plexus-compiler-javac-1.8.1.pom
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-javac/1.8.1/plexus-compiler-javac-1.8.1.pom (710 B at 3.0 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compilers/1.8.1/plexus-compilers-1.8.1.pom
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compilers/1.8.1/plexus-compilers-1.8.1.pom (2 KB at 3.9 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-api/1.8.1/plexus-compiler-api-1.8.1.jar
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-manager/1.8.1/plexus-compiler-manager-1.8.1.jar
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-javac/1.8.1/plexus-compiler-javac-1.8.1.jar
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-api/1.8.1/plexus-compiler-api-1.8.1.jar (20 KB at 39.4 KB/sec)
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-manager/1.8.1/plexus-compiler-manager-1.8.1.jar (6 KB at 10.8 KB/sec)
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-javac/1.8.1/plexus-compiler-javac-1.8.1.jar (13 KB at 12.3 KB/sec)
[INFO] Compiling 4 source files to D:\projectsWorkspace\connectingtopostgresdbtests\d\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] error: error reading C:\Users\Idan\.m2\repository\log4j\log4j\1.2.15\log4j-1.2.15.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\slf4j\slf4j-log4j12\1.5.2\slf4j-log4j12-1.5.2.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\ch\qos\logback\logback-classic\0.9.24\logback-classic-0.9.24.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-core\3.3.2.GA\hibernate-core-3.3.2.GA.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-annotations\3.4.0.GA\hibernate-annotations-3.4.0.GA.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-commons-annotations\3.3.0.ga\hibernate-commons-annotations-3.3.0.ga.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-entitymanager\3.4.0.GA\hibernate-entitymanager-3.4.0.GA.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\postgresql\postgresql\9.1-901.jdbc4\postgresql-9.1-901.jdbc4.jar; error in opening zip file
[INFO] 8 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.573s
[INFO] Finished at: Fri Mar 02 17:00:13 IST 2012
[INFO] Final Memory: 13M/222M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project d: Compilation failure: Compilation failure:
[ERROR] error: error reading C:\Users\Idan\.m2\repository\log4j\log4j\1.2.15\log4j-1.2.15.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\slf4j\slf4j-log4j12\1.5.2\slf4j-log4j12-1.5.2.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\ch\qos\logback\logback-classic\0.9.24\logback-classic-0.9.24.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-core\3.3.2.GA\hibernate-core-3.3.2.GA.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-annotations\3.4.0.GA\hibernate-annotations-3.4.0.GA.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-commons-annotations\3.3.0.ga\hibernate-commons-annotations-3.3.0.ga.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-entitymanager\3.4.0.GA\hibernate-entitymanager-3.4.0.GA.jar; error in opening zip file
[ERROR] error: error reading C:\Users\Idan\.m2\repository\postgresql\postgresql\9.1-901.jdbc4\postgresql-9.1-901.jdbc4.jar; error in opening zip file
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExceptio

谢谢您的帮助。


step1.

清洁你的.m2\repository或从中删除您的特定文件夹.m2\repository目录

step2.

run mvn clean install

step3.

确保运行此命令时您的互联网连接工作正常,有时会由于连接问题而失败。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

maven install 仅在第二次尝试后抛出“打开 zip 文件时出错” 的相关文章

  • .properties 中的通配符

    是否存在任何方法 我可以将通配符添加到属性文件中 并且具有所有含义 例如a b c d lalalala 或为所有以结尾的内容设置一个正则表达式a b c anything 普通的 Java 属性文件无法处理这个问题 不 请记住 它实际上是
  • Pig Udf 显示结果

    我是 Pig 的新手 我用 Java 编写了一个 udf 并且包含了一个 System out println 其中的声明 我必须知道在 Pig 中运行时该语句在哪里打印 假设你的UDF 扩展了 EvalFunc 您可以使用从返回的 Log
  • java.lang.IllegalStateException:应用程序 PagerAdapter 更改了适配器的内容,而没有调用 PagerAdapter#notifyDataSetChanged android

    我正在尝试使用静态类将值传递给视图 而不是使用意图 因为我必须传递大量数据 有时我会收到此错误 但无法找出主要原因是什么 Error java lang IllegalStateException The application s Pag
  • Java 集合的并集或交集

    建立并集或交集的最简单方法是什么Set在 Java 中 我见过这个简单问题的一些奇怪的解决方案 例如手动迭代这两个集合 最简单的单行解决方案是这样的 set1 addAll set2 Union set1 retainAll set2 In
  • 没有 Spring 的自定义 Prometheus 指标

    我需要为 Web 应用程序提供自定义指标 问题是我不能使用 Spring 但我必须使用 jax rs 端点 要求非常简单 想象一下 您有一个包含键值对的映射 其中键是指标名称 值是一个简单的整数 它是一个计数器 代码会是这样的 public
  • 将流转换为 IntStream

    我有一种感觉 我在这里错过了一些东西 我发现自己做了以下事情 private static int getHighestValue Map
  • 将 c3p0 与 Tomcat 8 数据源结合使用

    我有一个加载了数据源的 tomcat 8 服务器 我想知道是否可以将这个DataSource与c3p0连接池管理结合使用 到目前为止 这是我尝试过的 上下文 xml
  • 帮助将图像从 Servlet 获取到 JSP 页面 [重复]

    这个问题在这里已经有答案了 我目前必须生成一个显示字符串文本的图像 我需要在 Servlet 上制作此图像 然后以某种方式将图像传递到 JSP 页面 以便它可以显示它 我试图避免保存图像 而是以某种方式将图像流式传输到 JSP 自从我开始寻
  • Spring Boot Data JPA 从存储过程接收多个输出参数

    我尝试通过 Spring Boot Data JPA v2 2 6 调用具有多个输出参数的存储过程 但收到错误 DEBUG http nio 8080 exec 1 org hibernate engine jdbc spi SqlStat
  • Java ResultSet 如何检查是否有结果

    结果集 http java sun com j2se 1 4 2 docs api java sql ResultSet html没有 hasNext 方法 我想检查 resultSet 是否有任何值 这是正确的方法吗 if resultS
  • 如何对不同的参数类型使用相同的java方法?

    我的问题 我有 2 个已定义的记录 创建对象请求 更新对象请求 必须通过实用方法进行验证 由于这两个对象具有相同的字段 因此可以对这两种类型应用相同的验证方法 现在我只是使用两种方法进行重载 但它很冗长 public record Crea
  • 为什么 Java 8 不允许非公共默认方法?

    让我们举个例子 public interface Testerface default public String example return Hello public class Tester implements Testerface
  • 如何使用 jUnit 将测试用例添加到套件中?

    我有 2 个测试类 都扩展了TestCase 每个类都包含一堆针对我的程序运行的单独测试 如何将这两个类 以及它们拥有的所有测试 作为同一套件的一部分执行 我正在使用 jUnit 4 8 在 jUnit4 中你有这样的东西 RunWith
  • 专门针对 JSP 的测试驱动开发

    在理解 TDD 到底是什么之前 我就已经开始编写测试驱动的代码了 在没有实现的情况下调用函数和类可以帮助我以更快 更有效的方式理解和构建我的应用程序 所以我非常习惯编写代码 gt 编译它 gt 看到它失败 gt 通过构建其实现来修复它的过程
  • Cucumber 0.4.3 (cuke4duke) 与 java + maven gem 问题

    我最近开始为 Cucumber 安装一个示例项目 并尝试使用 maven java 运行它 我遵循了这个指南 http www goodercode com wp using cucumber tests with maven and ja
  • 非 Spring 托管类中 DI 的编译时编织

    我想为标记为的类配置编译时编织 Configurable注释能够将 spring 依赖项注入到初始化的类中new操作员 我不想使用加载时编织 因为我无权访问应用程序服务器的运行脚本 因此无法修改它 另外 我希望能够在测试中使用此类 我的意思
  • Android:无法使用 DbHelper 和 Contract 类将数据插入 SQLite

    public class Main2Activity extends AppCompatActivity private EditText editText1 editText2 editText3 editText4 private Bu
  • Eclipse 启动时崩溃;退出代码=13

    I am trying to work with Eclipse Helios on my x64 machine Im pretty sure now that this problem could occur with any ecli
  • 干净构建 Java 命令行

    我正在使用命令行编译使用 eclipse 编写的项目 如下所示 javac file java 然后运行 java file args here 我将如何运行干净的构建或编译 每当我重新编译时 除非删除所有内容 否则更改不会受到影响 cla
  • 双枢轴快速排序和快速排序有什么区别?

    我以前从未见过双枢轴快速排序 是快速排序的升级版吗 双枢轴快速排序和快速排序有什么区别 我在 Java 文档中找到了这个 排序算法是双枢轴快速排序 作者 弗拉基米尔 雅罗斯拉夫斯基 乔恩 本特利和约书亚 布洛赫 这个算法 在许多数据集上提供

随机推荐