Not sure why you would need the dependency on L with test scope.

It appears that project A always has project B which always needs L.

L has to be there regardless of whether you are in test or production.
It appears that you could just
a)remove the reference from A to L or
b) make it compile if you want and exclude it from A's dependency on B if you want to control the version in project A


Am I misreading your description?

Ron

On 19/01/2012 5:37 AM, Mickael Marrache wrote:
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




--
Ron Wheeler
President
Artifact Software Inc
email: [email protected]
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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

Reply via email to