There are two projects:
A —-has a lib commons vers. 1.3.7 —(depends on B)
B —-has lib commons vers. 1.2.5
So, we are building project B, lib commons vers. 1.2.5 will be included and installed in local repository, and then …
if we execute build of A(which is dependes on B), Maven decides that lib commons vers. 1.3.7 must be included, becouse that lib is on smallest distance from the root of the tree…
I know that if we set the version of artifact like: 1.2.5 -that is recommended version. But if we put it in [] – it is a hard requirement and maven should apply another strategy to resolve version conflict – to include recommended version of that artifact. But when I try to do it, it’s not working of couse, becouse Maven take artifact from loc repository, which contains reference on lib commons vers. 1.2.5 in manifest file, but lib which is included – commons vers. 1.3.7. Could you plese tell how can I solve this problem , or at list may be there are some tools or maven plugins which can tell about such conflits.
You need to use exclusions on the dependency. Something like that (its just a sample):
If you are using Eclipse and don’t want to do it by hand, you can do it by opening a pom file and selecting a ‘Dependency Hierarchy’ tab under which you can see all your dependency hierarchies. Then you can right click on the dependency you want to exclude and then click ‘Exclude Maven Artifact’