You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Jason Frank <jf...@guptamedia.com> on 2012/10/05 17:58:06 UTC
How to restrict transitive dependencies to one level
I know how to restrict a dependency with transitive="false" so that it
only brings in the direct dependency. Is it possible to control the
depth of transitive dependencies so that I bring in one level, but no
deeper? I want to bring in a dependency with all the things that it
directly depends on, but none of the further dependencies of those 2nd
level dependencies.
Here is why, and maybe there's a better solution. I have a project,
let's call it Project A, that depends on a 3rd-party project, let's call
that Project B. Project B has a few jars of its own, and it also
depends on a bunch of other 3rd-party jars. Project B exists in the
Ibiblio maven repository, so I am trying to use that so that I don't
need to bring all these jars into my private Ivy repository. The
dependencies of Project B are kind of a mess, in that their respective
transitive dependencies use different versions of various jars like
commons-logging. I have tried using the <override> element,
configurations, excludes, and various other tactics to get it to play
nicely, but it's proving quite elusive.
What I want to do now is, make a "fake" ivy artifact that lists all the
exact versions of Project B's direct jars and all the 3rd-party jars
that I want as dependencies, with transitive=false. Let's call this
fake ivy artifact Project C, and it represents the flattened
dependencies of Project B. Now I want to make Project A depend on
Project C, so that it will get all the things that I really wanted from
Project B. The problem I have is, I only want to get Project C's direct
dependencies into Project A, because I've carefully made those into the
exact jars I want. So I want to restrict the transitive resolution to
one level, when I say that Project A depends on Project C. Is this
possible?