[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Dependence on specific versions



On Fri, 11 Feb 2011 07:19:33 +0100, Torsten Werner wrote:
Hi Thomas,

On Thu, Feb 10, 2011 at 10:23 PM, Thomas Zeeman <tjzeeman@xs4all.nl> wrote:
Actually, you can predict it. Given the above order and no outside influences like a dependencyManagement block in your (parent) pom,  it would be 0.1. See http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html for a more detailed explanation on why this is and what surprising results the dependency mediation can have.

what I wanted to say: you cannot predict that for any non trivial real
work project.

I think you can. Given that maven creates its dependency graph as a tree where any transitive dependency which is also declared at the top level is cut out at the transitive level and it prioritizes transitive dependencies on depth in the tree first and on order of declaration in the pom second. Granted. It is not going to be easy on larger projects, but with enough patience and a large enough screen to show the entire tree at once its doable. And yes, I've had to do just that one more occasions than I would've liked already.

 Try to look at the dependency chain of maven itself. But
not for too long because of the danger of getting insane. :)

Too late. ;) I've had to do just that for a project where I had to mavenise a largish (~200 jars in the largest war, 300 different dependencies over all 4 wars), third party application using some homegrown, ant based build so we could use it as part of a new application. They were basically falling into all of the pitfalls a poorly dependency managed project can fall. Not pretty!

If a and c depend on the same part of the API of b and it has changed from .1 to .2 you will be in for either some spectacular failure at run time or some very subtle and hard to notice error in your application behaviour.

Yes, runtime is another step where the whole thing collapses. That is
probably why integration tests are more important in the Java world
[*] - the code uses different dependencies during unittest time
(provided by Maven) and after integration (something else).

If only more people would do that...

I've found automated deploys as part of a continuous build process also helps a lot too, but even that seems to be uncommon still.

Kind regards,
Thomas


Reply to: