Apache 的两个 Maven Artifact 中有四个重复类:commons-beanutils:commons-beanutils:1.8.3
和 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
是否可以用其他 Artifact 替换其中一个以避免重复?我试图谷歌但没有找到任何解决方案。相当烦人的问题。
最佳答案
在这种情况下,问题不是 maven 或排除项(这通常是问题所在),但您很可能使用了错误版本的 beanutils。
有一个包含 bean 集合的 beanutils jar 版本和一个不包含 bean 集合的版本。具有 bean 集合的 beanutils 的 Maven 依赖项包括公共(public)集合。如果您自己使用公共(public)集合,请使用核心版本并将公共(public)集合包含在 Maven 依赖项中。
在这里稍微解释一下:http://commons.apache.org/beanutils/
该页面是这样说的:
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
关于java - commons-collections 和 commons-beanutils 中的重复类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14402745/