You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by JVerstry <jv...@gmail.com> on 2011/09/11 08:25:03 UTC
About transitive dependencies
I came across an issue I raised on StackOverflow:
http://stackoverflow.com/questions/7373105/noclassdeffounderror-org-junit-afterclass-during-annotation-processing/7375380#7375380
I have a library B having a compile dependency (i.e. scope) on A.
I have a library C having a test dependency (i.e. scope) on B.
When I compile C, it includes B, but not A. And since C calls B calls A,
it crashes at runtime.
Apparently, this is how it should work according to the dependency scope
(http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope).
Yet, why should users of C explicitly declare a compile dependency to A,
when we know at compile time that A will be required? Shouldn't the
transitivity rule be that if you have such a transitive relationship, A
should always be compile dependency of A? Or is there something I am
missing?
The problem is that the runtime crash is really late to be notified
about this issue. It does not fit with the maven philosophy.
Thanks,
JVerstry
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: About transitive dependencies
Posted by Guillaume Polet <gu...@gmail.com>.
Why do you declare a test (scope) dependency to B if you call it at
runtime? AFIK, B should not be used when you compile C since you
declared a test (scope) dependency.
--
Guillaume
Le 11/09/2011 08:25, JVerstry a écrit :
> I came across an issue I raised on StackOverflow:
> http://stackoverflow.com/questions/7373105/noclassdeffounderror-org-junit-afterclass-during-annotation-processing/7375380#7375380
>
> I have a library B having a compile dependency (i.e. scope) on A.
> I have a library C having a test dependency (i.e. scope) on B.
>
> When I compile C, it includes B, but not A. And since C calls B calls
> A, it crashes at runtime.
>
> Apparently, this is how it should work according to the dependency
> scope
> (http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope).
>
> Yet, why should users of C explicitly declare a compile dependency to
> A, when we know at compile time that A will be required? Shouldn't the
> transitivity rule be that if you have such a transitive relationship,
> A should always be compile dependency of A? Or is there something I am
> missing?
>
> The problem is that the runtime crash is really late to be notified
> about this issue. It does not fit with the maven philosophy.
>
> Thanks,
>
> JVerstry
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org