• Let's assume my application needs foo.jar and bar.jar
  • foo.jar needs version 1.0 of c.jar
  • bar.jar needs version 2.0 of c.jar

How does Maven resolve this conflict? Which version of c.jar will be used?

有帮助吗?

解决方案

It depends on the order of declaration in your effective POM. If foo.jar shows up first you will get version 1.0 of c.jar. If on the other hand bar.jar is declared first it will be version 2.0 of c.jar.

Relevant documentation:

...two dependency versions are at the same depth in the dependency tree, until Maven 2.0.8 it was not defined which one would win, but since Maven 2.0.9 it's the order in the declaration that counts: the first declaration wins

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top