tobii tobii - 1 year ago 160
Java Question

Why is Eclipse Maven saying dependencies of same version are conflicting?

When I have a dependency listed more than once in my dependency tree, even if all versions of that dependency are the same, Eclipse will say (in the Dependency Hierarchy tab of a POM) that all but one are "(omitted for conflict with X.X.X)". The group ID, artifact ID, and version will all be the same.

Here's a simple example with a randomly chosen dependency. Notice maven-model and maven-artifact.

maven-core dependency conflict same versions

I'm using Eclipse Mars (4.5.0)

This doesn't seem to have any affect on anything, besides the misleading messages in the UI. It's just pretty annoying to see "omitted for conflict..." all over the place, especially if I'm wanting to see the true conflicts.

Answer Source

The "Dependency Hierarchy" tab of Eclipse is populated by the M2Eclipse plugin. And, unfortunately, it seems this is hard-coded inside the M2Eclipse plugin source code. Whatever the reason a dependency was omitted (duplicate, version conflict...), the M2Eclipse plugin will add the label "omitted for conflict with".

Note that this is not the case of the tree goal of the maven-dependency-plugin, from which this tab mimics the output. By default, the command mvn dependency:tree will not show dependencies that were omitted. If the verbose flag is set to true, then the output will show every dependency that were omitted for: being a duplicate of another; conflicting with another's version and/or scope; and introducing a cycle into the dependency tree.

I couldn't find a bug for this so you could maybe file an enhancement request, through their Bugzilla, to ask that the plugin adheres more with the output of dependency:tree (for example showing the real reason a dependency was omitted, instead of the current default) and to add an option to switch between verbose and not verbose mode.