سؤال

  • 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