本文介绍了错误:log4j-api-2.9.0.jar是一个多版本jar文件,但未设置--multi-release选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
探索 Java9使用以下最小 pom.xml
: -
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.9.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.9</source>
<target>1.9</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jdeps-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<goals>
<goal>jdkinternals</goal> <!-- verify main classes -->
<goal>test-jdkinternals</goal> <!-- verify test classes -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
执行时
mvn install
我最终得到一个详细错误,内容如下: -
I end up getting a detailed error that reads the following:-
[INFO] Error: log4j-api-2.9.0.jar is a multi-release jar file but --multi-release option is not set
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.389 s
[INFO] Finished at: ...
[INFO] Final Memory: 12M/41M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jdeps-plugin:3.1.0:jdkinternals (default) on project maven-jigsaw:
[ERROR] Exit code: 2
[ERROR] Command line was: /bin/sh -c '/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin/jdeps' '-cp' '.../.m2/repository/org/apache/logging/log4j/log4j-api/2.9.0/log4j-api-2.9.0.jar' '../maven/target/classes'
我找不到与相关的很多相关信息 - 多版本
I couldn't find much relevance related to --multi-release
flag in either jdeps:jdkinternals
goal detailed on Maven's official site or even in the jdeps
tool documented at Oracle help center.
有人可以抛出一些点亮 maven-jdeps-plugin
中的此实现?有没有办法解决这个问题(设置 - 多版本
选项)?
Can someone throw some light on this implementation in maven-jdeps-plugin
? Is there a way to fix this(set the --multi-release
option)?
推荐答案
这是用户错误。请输入jdeps - ?在命令行上。您将看到需要输入
This is user error. Please enter jdeps -? on the command line. You will see you need to enter
jdeps --multi-release 9 ~/.m2/repository/org/apache/logging/log4j/log4j-api/2.9.1/log4j-api-2.9.1.jar
这篇关于错误:log4j-api-2.9.0.jar是一个多版本jar文件,但未设置--multi-release选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!