On 13/08/2010 11:35 AM, C. Benson Manica wrote:
I have projects A, B, C, and D. A is basically a database API that a
variety of projects use. B depends on A, C depends on B and A, and D
depends on C and A. When building project D, I could therefore
theoretically end up with as many as three different versions of A - one
each from the transitive dependencies of B and C, and another one from D's
explicit dependency. What I want is for D to include the "latest" version
of A based on these three dependencies, so if B depends on A-3.1, C depends
on A-3.3, and D depends on A-3.2, the actual artifact on D's classpath will
be A-3.3. Obviously exclusions and optional dependencies don't really do
what I want, because I don't know which dependency on A is the "latest". Is
there a way to do anything remotely like this?
(Obviously, yes, I'm now aware that if this project were designed correctly,
there wouldn't be this web of transitive dependencies in the first place,
but fixing that isn't really possible at the moment.)
Your underlying believe that A-3.1 and A-3.3 are all equally functional
for your projects is a bit hard to defend and I can see that you have
figured this out.
So much for the criticism, now some ideas.
Make a parent POM and add a dependency management section where you can
override the lower level POMs' version choices so you force everyone to
use A-3.3.
If you are just trying to avoid figuring out the latest version, you can
get help from Maven's dependency tree which will tell you if you have a
version conflict on an artifact in your tree and will tell you what
versions are involved and who is dragging in the old ones.
Then you can fix D to have the right version regardless of the lower
level POMS.
Ron
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]