When I run your example with mvn dependency:tree this is what I get:

[INFO] [dependency:tree]
[INFO] foo.bar:foo-bar-parent:pom:0.0.1-SNAPSHOT
[INFO] \- org.apache.velocity:velocity:jar:1.6.2:test
[INFO]    +- commons-collections:commons-collections:jar:3.2.1:test
[INFO]    +- commons-lang:commons-lang:jar:2.4:test
[INFO]    \- oro:oro:jar:2.0.8:test
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - foo.bar:a:jar:0.0.1-SNAPSHOT
[INFO]    task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree]
[INFO] foo.bar:a:jar:0.0.1-SNAPSHOT
[INFO] \- org.apache.velocity:velocity:jar:1.6.2:compile
[INFO]    +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO]    +- commons-lang:commons-lang:jar:2.4:compile
[INFO]    \- oro:oro:jar:2.0.8:compile
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - foo.bar:b:war:0.0.1-SNAPSHOT
[INFO]    task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree]
[INFO] foo.bar:b:war:0.0.1-SNAPSHOT
[INFO] +- foo.bar:a:jar:0.0.1-SNAPSHOT:compile
[INFO] \- org.apache.velocity:velocity:jar:1.6.2:test (scope not
updated to compile)
[INFO]    +- commons-collections:commons-collections:jar:3.2.1:test
[INFO]    +- commons-lang:commons-lang:jar:2.4:test
[INFO]    \- oro:oro:jar:2.0.8:test

Mind the "scope not updated to compile", so Maven sees something
strange. I don't know whether this is a bug or a feature ;) or what
the rationale is behind it.

Can someone explain?

With regards,

Nick Stolwijk
~Java Developer~

Iprofs BV.
Claus Sluterweg 125
2012 WS Haarlem
www.iprofs.nl



On Wed, May 6, 2009 at 11:29 AM, Stevo Slavić <[email protected]> wrote:
> Hello Maven users,
>
> If a parent module (e.g. P) of a multi module project defines a test scope
> dependency to some library (e.g. library "LIB"), and if one of projects's
> child modules which inherit P (e.g. jar module A) defines compile scope
> dependency to the same (LIB) library, and if some other child module which
> also inherits P (e.g. war module B) defines compile scope dependency on
> module A, then (at least when using maven 2.1.0) library LIB does not get
> included in war of module B. It seems that scope (in this example test
> scope) of inherited dependency wins over scope (in this example compile
> scope) of transitive dependency.
>
> This looks like a bug to me (maybe just in maven-war-plugin:2.1-beta-1, or
> maven-dependency-plugin:2.1) - even though module B (through inheritance)
> defines LIB as test scope dependency but on the other hand it's dependency
> defines same LIB as compile scope dependency so LIB should be included in
> module B war. Currently a workaround is to explicitly define compile time
> dependency to LIB in module B, even though it doesn't make direct use of the
> LIB. As subject states, maybe I've misunderstood the dependency resolution
> mechanism.
>
> Attached is example project which demonstrates the issue.
>
> Regards,
> Stevo.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to