Maven依赖log4j错误

ant*_*ant 12 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
Run Code Online (Sandbox Code Playgroud)

我正在使用这种依赖:

<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.15</version>
  <scope>provided</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题 ?

Mar*_*tin 23

您很可能不需要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>
Run Code Online (Sandbox Code Playgroud)


Pas*_*ent 11

说真的,这些对JMX,JMS,Java Mail的依赖是荒谬的,并且必须处理排除以进行一些日志记录让我无言以对.所以,我宁愿使用以前版本的log4j(1.2.14)或只是切换到logback.