0

Let's say I have a maven project that depend on one external library libA. And libA depends on libB. In my pom.xml, I declare libA as a dependency and all is well.

Not let's assume that during dev, I start using classes from libB too. libB is already pulled in the project through libA, so everything compiles fine and work, but should I also declare libB in my pom.xml?

If I don't, mvn dependency:analyze will complain that I use undeclared dependencies.

If I declare libB, maven will load it only once to avoid duplicates, so if I declare it after, it's as if I didn't, and if I declared it before, I risk forcing a version of libB incompatible with libA.

What's the better answer?

elcye
  • 139
  • 1
  • 9

1 Answers1

0

Do what Federico suggests. It is the Maven way.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142