Yes, I would tend to agree that this noted cell should be 'runtime'.
The case where there's a dependency to a class (B) that extends one from
another library (C) makes my code compile dependent on that library (C). I
think my project needs to keep track of the version of library C to avoid
surprises when changes happen.
But others may disagree :-)

On Sun, Nov 30, 2008 at 1:24 AM, Mohan K R <[EMAIL PROTECTED]> wrote:

> Thanks Walid. I think this is where my confusion is, the default scope is
> compile. And
> as per the matrix on the maven site it has an asterik describing the scope
> resolution.
> (for transitive dependencies)
>
> quote from docs: (
>
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> )
>
> *(*) Note:* it is intended that this should be runtime scope instead, so
> that all compile dependencies must be explicitly listed - however, there is
> the case where the library you depend on extends a class from another
> library, forcing you to have available at compile time. For this reason,
> compile time dependencies remain as compile scope even when they are
> transitive.
>
> The above is the explanation for compile time dependency, as per above, it
> should not
> be runtime scope in C as you described or am I interpreting this wrong? It
> appears that
> if your explanation is right, then the doc should change that to runtime,
> at
> least that
> is what appears to be the behaviour in Maven 2.0.9.
>
>
> Thanks again
>
>
>
> On Sat, Nov 29, 2008 at 6:08 PM, Walid jo Gedeon <[EMAIL PROTECTED]>
> wrote:
>
> > Hello Mohan,
> >
> > In more technical jargon, log4j in your example is a compile time
> > dependency
> > of A, and only a runtime dependency of C, which means that if you want to
> > make log4j calls in C, you need to declare it as a compile time
> dependency
> > (default scope).
> >
> > HTH,
> > w
> >
> > On Sun, Nov 30, 2008 at 12:20 AM, Mohan K R <[EMAIL PROTECTED]> wrote:
> >
> > > It appears that I'm missing something critical here, so please help me
> > out.
> > > I have a standard
> > > multi-module project like this. (I'm using Maven 2.0.9, JDK5).
> > >
> > >  parent (P) -
> > >            |- module A
> > >            |- module B
> > >            |- module C
> > >
> > >
> > > A,B,C all inherit from the parent P.
> > >
> > > Now in my parent POM (P): I have a dependencyManagement section in the
> > POM.
> > >  <depedencyManagement>
> > >    <dependencies>
> > >       <dependency>
> > >           <groupId>log4j</groupId>
> > >           <artifactId>log4j</artifactId>
> > >           <version>1.2.14</version>
> > >       <dependency>
> > >       <...  bunch of others ...>
> > >    <dependencies>
> > >  </dependencyManagement>
> > >
> > > Now in module A (I have a dependency on log4j), so only thing that I
> > > provide
> > > is (notice no version):
> > >
> > >    <dependencies>
> > >       <dependency>
> > >           <groupId>log4j</groupId>
> > >           <artifactId>log4j</artifactId>
> > >       <dependency>
> > >       <...  bunch of others ...>
> > >    <dependencies>
> > >
> > > Now in module B depends on module A so I have this in my dependency:
> > >    <dependencies>
> > >       <dependency>
> > >           <groupId>${project.groupId}</groupId>
> > >           <artifactId>module_A</artifactId> <!-- NOTICE MODULE A -->
> > >           <version>${project.version}</version>
> > >       <dependency>
> > >       <...  bunch of others ...*but no log4j*>
> > >    <dependencies>
> > > NOTE: I do use log4j in B, but it got transitively pulled in. So far so
> > > good.
> > >
> > > Now Module C, depends on Module B. So what I have is:
> > >    <dependencies>
> > >       <dependency>
> > >           <groupId>${project.groupId}</groupId>
> > >           <artifactId>module_B</artifactId>           <!-- NOTICE
> MODULE
> > B
> > > -->
> > >           <version>${project.version}</version>
> > >       <dependency>
> > >       <...  bunch of others ...>
> > >    <dependencies>
> > > Now, I do use some log4j calls (LogFactory), but for some reason log4j
> > does
> > > not
> > > get pulled in transitively??? I have to explicitly give a dependency on
> > > log4j *or*
> > > module_A to get it to compile??
> > >
> > > My first that was, all transitive dependencies on module_B should get
> > > pulled
> > > in which
> > > means module_A and in turn its transitive dependency log4j. But nothing
> > of
> > > this sort
> > > is happening? Any ideas? Is it the dependecyManagement section (which
> has
> > > the version)
> > > that is messing me up, since C does inherit from P?
> > >
> > > Thanks
> > > Mohan K
> > >
> >
>

Reply via email to