I would like to use both spring-amqp and spring-data-mongodb in a Maven project. Spring-amqp depends on Spring 3.0.7 whereas spring-data-mongodb depends on Spring 3.1.2. The end result is that I have packages from both Spring 3.0.7 and 3.1.2 in my depdendency tree, and this appears to cause problems at runtime.
How should I resolve the issue? Manually add direct dependencies with a specific version to my project from either for all of the transitive dependencies of both spring-amqp and spring-data-mongodb? Recompile one or both to depend on a common Spring version?
Take a look at dependencyManagement section of POM. Once you specify artifact versions there, maven is forced to use them in that module and it’s children.