maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kirk Roberts <k...@languagecomputer.com>
Subject question regarding exclusions and indirect dependencies
Date Fri, 27 Feb 2009 18:34:35 GMT
Apologies if someone has already answered this, a link would suffice.

I'm having a problem with the way maven dependencies handle exclusions. 
  Let me set up a little example:

* Project LOW_LEVEL has dependencies 1 and 2
* Project MID_LEVEL_1 has LOW_LEVEL as a dependency, but does not need 
dependency 2, so excludes it in its pom
* Project MID_LEVEL_2 has LOW_LEVEL as a dependency, but does not need 
dependency 1, so excludes it in its pom
* Project HIGH_LEVEL has MID_LEVEL_1 and MID_LEVEL_2 as dependencies

Now I would hope that my dependency tree would include HIGH_LEVEL, 
MID_LEVEL_1, MID_LEVEL_2, LOW_LEVEL, 1, and 2.  Unfortunately it won't. 
  It'll look something like this:

HIGH_LEVEL
+- MID_LEVEL_1
|  \- LOW_LEVEL
|     \- 1
\- MID_LEVEL_2

The problem, as I see it, is that Maven doesn't analyze all the 
dependencies.  It sees LOW_LEVEL, grabs its dependencies at that point, 
and then once it sees LOW_LEVEL again it ignores it as well as any 
additional dependencies it might have (in this case, the LOW_LEVEL as a 
dependency of MID_LEVEL_2).

Now clearly, my projects aren't set up as well as I'd have liked. 
Basically, they were made before we switched over to Maven.  Totally 
refactoring them all so that this kind of problem doesn't happen is 
essentially out of the question as it would take too much time.

One solution is to directly depend on the "missing" dependencies (in 
this case project 2).  But clearly that is a very indirect dependency, 
and I would prefer to avoid this scenario if at all possible.

So my question: is there some maven "mode" that could help me here and 
transverse the entire dependency tree?  I'm sure it'll take much longer, 
but I'm willing to let that happen under certain circumstances.  Or am I 
just in tough luck and refactoring or careful use of exclusions is 
necessary?

Obviously, the example above it a toy scenario.  In reality, we have 
many maven projects and the high-level projects don't use 90% of them. 
I'd like for people in charge of projects to locally decide what 
exclusions to use, but the problem above would cause the high-level 
projects to have to include many many indirect dependencies.  I just 
don't think that would be very stable since not every developer should 
be expected to know the dependencies of every project.

Any insight, common experience, or solutions (!) would be greatly 
appreciated,

Kirk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message