You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Laird Nelson <lj...@gmail.com> on 2017/05/31 21:30:00 UTC
Transitive dependency question
(I've been working with Maven since at least 2004 and I think I *still* don't
get transitive dependencies.)
I have a pom.xml file of type pom that has some compile-scoped dependencies
in it. (P1 -> A(compile), B(compile))
I have another project that depends on this pom in provided scope (I'm just
playing around for now). The intention is that I will "get" all the
transitive compile-scoped dependencies of the pom artifact I'm depending
on, but in provided scope. (P2 -> P1(provided); result is effectively: P2
-> P1(provided) -> A(provided), B(provided))
If that's all I have, then indeed, that's the result I observe: when I run
the maven-dependency-plugin's dependency-tree goal, I see these transitive
dependencies and they are all marked as being in provided scope, not
compile. I see, in other words, the tree representation of P2 ->
P1(provided) -> A(provided), B(provided). So far so good.
Now I pull in another (jar) dependency in runtime scope. It has some
transitive dependencies in compile scope. Fine. They don't include any of
the dependencies mentioned in my second paragraph. (P2 -> (P1(provided) ->
A(provided),B(provided)), (P3(runtime) -> C(compile),D(compile))) Note
that this pseudo-language is what I *expect* to see.
When I run dependency:tree on this hairy mess, it does *not* show the
representation of my pseudo-language above. Instead, it shows the
transitive dependencies from my third paragraph as direct "children" of the
pom-type artifact I'm pulling in in provided scope (P1), but they all have
a scope of runtime. So, for just this part of the tree: P2 -> P1(provided)
-> A(runtime(!)), B(runtime(!))
What the…? In other words, somebody in the tree is "promoting" my A and B
dependencies to runtime scope. But I can't tell from the tree output who
it is, because A and B (that are now apparently runtime-scoped
dependencies) are still showing as children of my pom artifact (P1,
mentioned in my second paragraph).
Is this all according to plan? I'm using version 3.0.0 of the
maven-dependency-plugin and version 3.5.0 of Maven itself.
Best,
Laird
Re: Transitive dependency question
Posted by Stephen Connolly <st...@gmail.com>.
I think that is a bug that is in scope for 3.5.1 or 3.6.0
On 31 May 2017 at 22:30, Laird Nelson <lj...@gmail.com> wrote:
> (I've been working with Maven since at least 2004 and I think I *still*
> don't
> get transitive dependencies.)
>
> I have a pom.xml file of type pom that has some compile-scoped dependencies
> in it. (P1 -> A(compile), B(compile))
>
> I have another project that depends on this pom in provided scope (I'm just
> playing around for now). The intention is that I will "get" all the
> transitive compile-scoped dependencies of the pom artifact I'm depending
> on, but in provided scope. (P2 -> P1(provided); result is effectively: P2
> -> P1(provided) -> A(provided), B(provided))
>
> If that's all I have, then indeed, that's the result I observe: when I run
> the maven-dependency-plugin's dependency-tree goal, I see these transitive
> dependencies and they are all marked as being in provided scope, not
> compile. I see, in other words, the tree representation of P2 ->
> P1(provided) -> A(provided), B(provided). So far so good.
>
> Now I pull in another (jar) dependency in runtime scope. It has some
> transitive dependencies in compile scope. Fine. They don't include any of
> the dependencies mentioned in my second paragraph. (P2 -> (P1(provided) ->
> A(provided),B(provided)), (P3(runtime) -> C(compile),D(compile))) Note
> that this pseudo-language is what I *expect* to see.
>
> When I run dependency:tree on this hairy mess, it does *not* show the
> representation of my pseudo-language above. Instead, it shows the
> transitive dependencies from my third paragraph as direct "children" of the
> pom-type artifact I'm pulling in in provided scope (P1), but they all have
> a scope of runtime. So, for just this part of the tree: P2 -> P1(provided)
> -> A(runtime(!)), B(runtime(!))
>
> What the…? In other words, somebody in the tree is "promoting" my A and B
> dependencies to runtime scope. But I can't tell from the tree output who
> it is, because A and B (that are now apparently runtime-scoped
> dependencies) are still showing as children of my pom artifact (P1,
> mentioned in my second paragraph).
>
> Is this all according to plan? I'm using version 3.0.0 of the
> maven-dependency-plugin and version 3.5.0 of Maven itself.
>
> Best,
> Laird
>