I'm not sure what either of you mean here.

Normally, your lib's pom just declares a dependency on the "recommended"
version of the lib you want (Spring in this case), eg
  <version>2.0.4</version>

When a project depends on your lib but doesn't otherwise use Spring,
then your "recommended" version is used. If the project does use Spring
itself, then the version it specifies overrides the one that your pom
specifies. This overriding happens automatically; the version *closest
to the pom being built* always has priority.

If your library is known not to work with certain spring versions (eg
cannot work with Spring <1.5 and cannot work with spring 2.0 or later)
then your lib's pom should use a version-range to indicate that. Then if
anyone's pom has a direct Spring dependency that is incompatible with
that range then an error is displayed - but otherwise their version has
priority.

I don't know what version you get when a pom specifies a range and
nothing overrides it; probably the lower-bound of the range is used as
that is the "stable" (repeatable) option.

And all of this applies to dependencies of any scope. Scope of
"provided" has other implications..

Regards,
Simon

Stephen Connolly schrieb:
> <scope>provided</scope>
>
> On Feb 16, 2008 7:05 PM, James Carman <[EMAIL PROTECTED]> wrote:
>
>   
>> What is the "maven way" of doing this?  Suppose a library you're
>> writing requires Spring.  You write your library against an older
>> version of Spring (2.0) and you define it as a dependency.  Now, when
>> other projects want to use your library, spring-2.0.jar will be
>> included in their classpath as a transitive dependency.  But, what if
>> the project wants to use Spring 2.5.1?  They would have to do an
>> exclusion on their dependency to tell it not to include the
>> spring-2.0.jar, right?  What scope should the library put on the
>> spring dependency so that any projects using that library can provide
>> their own version of spring?
>>
>> James
>>
>> ---------------------------------------------------------------------
>> 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