We're in the situation where we update commons-collections from version 3 to version 4. As they've changed the group id to commons-collections4 we will end up having 2 versions of commons-collection in the classpath. The version 3 and version 4. For our development the version 4 should be used. The version 3 will come in through external dependencies so if we have like:
compile ("org.hibernate:hibernate-entitymanager:3.5.6-Final")
the version 3, which will come in through hibernate-entitymanager, will also be available at compile time. So the developers could use it.
Is there a way to say "commons-collections 3 should now be considered as runtime dependency when it comes through hibernate-entitymanager"?
We're using Gradle 3.5.
Thanks to webdizz who brings me to that idea it seems that I managed it by doing the following:
configurations.compileClasspath.resolutionStrategy {
dependencySubstitution {
substitute module('commons-collections:commons-collections') with module("org.apache.commons:commons-collections4:${COMMONS_COLLECTIONS_VERSION}")
}
}
(In later versions of gradle, replace 'with' with 'using')