Hi,

I have a project A that uses library L v1.0.0 with test scope.

Project A also depends on project B (with scope compile), with B transitively 
depending on the library L v1.0.0 (with scope compile). So, according to the 
documentation (Introduction to dependency mechanism), project A depends on 
project B with scope "compile" and the transitive dependency on L has a 
"compile" scope, the final scope of L should be "compile".

Here, Maven sees one dependency on L with scope "compile" (after applying the 
dependency algorithm), and one dependency on L with scope "test". Why the final 
scope of the library L for project A is 'test'? It seems that the dependency 
definition of project A on library L overrides those of the transitive 
dependencies on L.

It causes me NotClassDefFoundError at runtime.

What's wrong here? My project A only uses L for unit tests so I define the 
dependency with 'test' scope. But, at the end, I want L to be on my classpath 
since project A depends on project B for production, and B needs (transitively) 
library L also for production. (By production, I mean not unit tests.)

Thanks for helping me

Reply via email to