Hi,
Currently sling-(bundle)-parent always also managed the scope (in most cases 
“provided”) for (almost all) its managed dependencies:

https://github.com/apache/sling-parent/blob/e42fd6e5fac8ed9becf722b5241d01d3147338c4/sling-parent/pom.xml#L939-L1001
 
<https://github.com/apache/sling-parent/blob/master/sling-parent/pom.xml#L939-L1001>
https://github.com/apache/sling-parent/blob/e42fd6e5fac8ed9becf722b5241d01d3147338c4/sling-bundle-parent/pom.xml#L208-L315
 
<https://github.com/apache/sling-parent/blob/e42fd6e5fac8ed9becf722b5241d01d3147338c4/sling-bundle-parent/pom.xml#L208-L315>

IMHO managing the scope in the depMgmt is an anti-pattern [1], as it makes it 
very hard to override the scope. Each consumer should decide on its own which 
scope a dependency should have. 
One concrete example being 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/blob/master/core/pom.xml
 
<https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/blob/master/core/pom.xml>
 which depends on a lot of OSGi dependencies which usually have scope “test” 
for consuming bundles, but the transitive dependency scope is actually 
overwritten to “provided" due to the use of our sling-parent. Removing the 
scope though is potentially backwards-incompatible though.

So what should we do in the future?

1. Stay with declaring the scope in the depMgmt (and also add “provided” to the 
few one, where scope is not yet managed)
2. Remove scope from all dependencies except for pure testing dependencies 
(junit, ….)

I would tend to implement option 2.
WDYT?

Thanks,
Konrad

[1] - https://stackoverflow.com/a/20750041

Reply via email to