maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <>
Subject Re: Provided scope dependencies
Date Fri, 15 Mar 2013 08:51:32 GMT
Hi Patrick,

Patrick Schlebusch wrote:

> Thanks, this is exactly what I was getting at.
> As this higher-level project does not reference javax.mail:mail in any
> way, it should not have to specify a direct dependency on it imho.
> Yet in the current state of things it needs to, but only in the special
> case that the provided scope is used by the primordial project.
> While this might all sound a bit abstract, we actually run into these
> problems when working with OSGi bundles (which is mentioned as an affected
> use case in the JIRA as well).
> The provided scope fits pretty nicely for bundles, since we do not want to
> package these dependencies but need to compile against them.
> I guess I just don't see why it would be a good thing to not provide
> compile-time dependencies transitively. I thought that was one of the core
> ideas of Maven?

in the end, you always control it yourself (that's what project parents and 
dependencyManagement sections are for) and in combination with properties 
you have absolute control.

Parent POM for a project:

============ %< =============
  <!-- scope defaults, even for transitive deps -->
============ %< =============

In an artifact of the project that should not include this dependency, e.g. 
for an EAR or WAR:

============ %< =============
  <relativePath/> <!-- is not necessarily physical parent! -->
============ %< =============

Now, if all artifacts of a project refer the same parent (directly or 
indirectly), you can overwite the scope (and version) of any dependency used 
anywhere in this project with that single declaration in the depMgmt section 
of the parent with own defaults that can be overwritten in the POMs of the 
individual artifacts.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message