commons-collections 和 commons-beanutils 中的重复类 [英] duplicate classes in commons-collections and commons-beanutils
问题描述
Apache 的两个 Maven 工件中有四个重复的类:commons-beanutils:commons-beanutils:1.8.3
和 commons-collections:commons-collections:3.2.1代码>:
org.apache.commons.collections.ArrayStackorg.apache.commons.collections.Bufferorg.apache.commons.collections.BufferUnderflowExceptionorg.apache.commons.collections.FastHashMap
是否可以用其他工件替换其中之一以避免这种重复?我试图谷歌但没有找到任何解决方案.比较烦人的问题.
在这种情况下,问题不在于 maven 或排除(这通常是问题所在),而很可能是您使用了错误版本的 beanutils.
>
有一个版本的 beanutils jar 包含 bean 集合,一个不包含.带有 bean 集合的 beanutils 的 maven 依赖项包括 commons 集合.如果您自己使用的是公共集合,请使用 Maven 依赖项中的核心版本并包含公共集合.
这里稍微解释一下:http://commons.apache.org/beanutils/一个>
那个页面是这样写的:
<块引用>commons-beanutils.jar - 包含一切commons-beanutils-core.jar - 不包括 Bean Collections 类commons-beanutils-bean-collections.jar - 仅 Bean Collections 类主要的 commons-beanutils.jar 对 Commons Collections 有一个可选的依赖
There are four duplicate classes in two Maven artifacts from Apache: commons-beanutils:commons-beanutils:1.8.3
and commons-collections:commons-collections:3.2.1
:
org.apache.commons.collections.ArrayStack
org.apache.commons.collections.Buffer
org.apache.commons.collections.BufferUnderflowException
org.apache.commons.collections.FastHashMap
Is it possible to replace one of them with some other artifact to avoid this duplication? I tried to google but didn't find any solution. Rather annoying problem.
In this case, the problem isn't maven or exclusions (which usually is the issue) but you are using the wrong version of beanutils most likely.
There is a version of the beanutils jar that has bean collections included and one that does not. The maven dependencies for the beanutils with bean collections includes commons collections. If you are using commons collections yourself, use the core version of and include commons collections in the maven dependencies.
This is where it is explained a bit: http://commons.apache.org/beanutils/
That page says this:
commons-beanutils.jar - contains everything commons-beanutils-core.jar - excludes Bean Collections classes commons-beanutils-bean-collections.jar - only Bean Collections classes The main commons-beanutils.jar has an optional dependency on Commons Collections
这篇关于commons-collections 和 commons-beanutils 中的重复类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!