java - Maven 依赖 log4j 错误

标签 java eclipse maven-2 log4j

大家好,我有一个错误,它无缘无故地破坏了我的构建,这里是错误消息:

error: error reading
/.m2/repository/com/sun/jdmk/jmxtools/1.2.1/jmxtools-1.2.1.jar;
error in opening zip file error: error
reading
/.m2/repository/com/sun/jmx/jmxri/1.2.1/jmxri-1.2.1.jar;
error in opening zip file

我正在使用这个依赖:

<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.15</version>
  <scope>provided</scope>
</dependency>

我该如何解决这个问题?

最佳答案

您很可能不需要 jmxtools 或 jmxri,因此您可以将它们从依赖项中排除:

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.15</version>
    <scope>provided</scope>
    <exclusions>
        <exclusion>
          <groupId>com.sun.jdmk</groupId>
          <artifactId>jmxtools</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.jmx</groupId>
          <artifactId>jmxri</artifactId>
        </exclusion>
    </exclusions>
</dependency>

关于java - Maven 依赖 log4j 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2310633/

相关文章:

java: 不兼容的类型: java.lang.String 无法转换为 double

java - 什么情况下toSet会抛出java.lang.IllegalArgumentException?

java - 无法 Autowiring 。找不到 `Repository' 类型的 bean

eclipse - HTTP 状态 404 描述 请求的资源 () 不可用。 Apache Tomcat/7.0.27

java - 如何阻止 View 在工作台重新启动时重新出现?

java - 安装第 3 方 JAR

java.lang.IllegalArgumentException : No more parsing elements

java - Eclipse 项目无法识别 Swagger Codegen Artifact

java - Maven 无法找到插件描述符

maven-2 - 如何在没有根项目的情况下在 Maven3 中执行 Reactor 构建?