gpt4 book ai didi

maven - 如何避免 Maven 构建中的 "Overlappping classes"警告?

转载 作者:行者123 更新时间:2023-12-01 07:04:27 24 4
gpt4 key购买 nike

我有一个依赖于其他两个项目的模块,但是在构建项目时我得到了这个。

虽然没有错误出现,但我收到很多关于重叠同一类的警告:

[WARNING] commons-logging-1.2.jar, jcl-over-slf4j-1.7.12.jar define 6 overlappping classes: 
[WARNING] - org.apache.commons.logging.impl.SimpleLog$1
[WARNING] - org.apache.commons.logging.Log
[WARNING] - org.apache.commons.logging.impl.SimpleLog
[WARNING] - org.apache.commons.logging.LogConfigurationException
[WARNING] - org.apache.commons.logging.impl.NoOpLog
[WARNING] - org.apache.commons.logging.LogFactory
[WARNING] aspectjrt-1.7.0.jar, aspectjweaver-1.8.6.jar define 128 overlappping classes:
[WARNING] - org.aspectj.internal.lang.reflect.SignaturePatternImpl
[WARNING] - org.aspectj.runtime.reflect.SignatureImpl
[WARNING] - org.aspectj.internal.lang.reflect.DeclareSoftImpl
[WARNING] - org.aspectj.lang.reflect.AjType
[WARNING] - org.aspectj.lang.JoinPoint$StaticPart
[WARNING] - org.aspectj.runtime.internal.cflowstack.ThreadStackImpl11
[WARNING] - org.aspectj.runtime.internal.cflowstack.ThreadStack
[WARNING] - org.aspectj.internal.lang.reflect.InterTypeDeclarationImpl
[WARNING] - org.aspectj.internal.lang.reflect.DeclareAnnotationImpl
[WARNING] - org.aspectj.lang.annotation.SuppressAjWarnings
[WARNING] - 118 more...
[WARNING] maven-shade-plugin has detected that some .class files
[WARNING] are present in two or more JARs. When this happens, only
[WARNING] one single version of the class is copied in the uberjar.
[WARNING] Usually this is not harmful and you can skeep these
[WARNING] warnings, otherwise try to manually exclude artifacts
[WARNING] based on mvn dependency:tree -Ddetail=true and the above
[WARNING] output
[WARNING] See http://docs.codehaus.org/display/MAVENUSER/Shade+Plugin
[INFO] Replacing original artifact with shaded artifact.

我怎样才能避免这些警告?

最佳答案

使用 Maven plugin Dependency Tree , 并且这样做

mvn clean dependency:tree
# or (mvn 3)
mvn clean org.apache.maven.plugins:maven-dependency-plugin:3.0.1:tree
clean避免旧的 target 的任何副作用很重要内容。

然后,根据您使用的插件,您可以添加排除规则,如 this answer ,以避免那些错误信息。

MRUNIT-209 中所示, dependency-tree 的 2.5.1 版本不与 Maven 3.x.x 一起运行。
使用全名 org.apache.maven.plugins:maven-dependency-plugin:3.0.1:tree将强制使用 3.0.1 版本的 maven-dependency-plugin。

关于maven - 如何避免 Maven 构建中的 "Overlappping classes"警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44217445/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com