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