Java Maven依赖项log4j错误
大家好,我有一个错误,它无缘无故破坏了我的构建,下面是错误消息:Java Maven依赖项log4j错误,java,eclipse,maven-2,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 我
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>
log4j
log4j
1.2.15
假如
如何修复此问题?您很可能不需要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>
log4j
log4j
1.2.15
假如
com.sun.jdmk
jmxtools
com.sun.jmx
jmxri
说真的,这些对JMX、JMS、Java邮件的依赖是荒谬的,为了做一些日志记录而不得不处理排除问题让我说不出话来。因此,我宁愿使用以前版本的log4j(1.2.14)或直接切换到。(+1)也为jmxri添加一个排除项。正如Pascal所说,也为Java邮件和JMS添加排除项。提供的范围?有时最好使用自己的日志库(正如Pascal所说的)而不是提供的环境一。有用的注释。我还决定切换到1.2.14。他们会使用“可选”maven依赖项吗?