All managed dependencies in wcm-io-tooling-aem-cloud-dependencies should have scope "provided"

Description

As those dependencies should be referenced with scope provided in almost all of the cases the scope provided should be set by default in https://github.com/wcm-io/wcm-io-tooling-aem-cloud-dependencies/blob/develop/pom.xml.

Activity

Show:
Konrad Windszus
November 26, 2020, 9:38 AM

Thanks for the comments. Indeed the dependency management scope always overrides any scope defined on the actual dependency, but import scope is a bit special… Hopefully https://issues.apache.org/jira/browse/MNG-5971 will allow to distinguish between “final” and “default” values, because I would say making the dependencies have scope “provided” by default makes a lot of sense. Often developers forget to add an explicit scope (therefore using “compile”) which may lead to subtle issues for upstream dependencies…

Let us close this for now as Maven does not allow to define “default” scopes unfortunately.

Stefan Seifert
November 25, 2020, 2:22 PM
Edited

i'm the opinion and practiced it for years that dependencies declared in dependencyManagement (defined explicitly or imported via import scope) should never have a scope defined. defining the correct scope should be done only in the dependencies of the POM section where it is used.

i tried to find some links to best practices if this is still "state-of-the-art", there are some very old discussions on
https://stackoverflow.com/questions/15221299/dependencymanagement-and-scope
pointing into the same direction.

-whatever the best pratice is - i did a short test defining the scope for a dependency that is defined in a POM imported with scope=import - and it seems the scope defined in the imported POM is ignored anyway - so it is quite useless to do it there.- this was in error in my test, it works. but i do not consider it as best practice.

Won't Do

Assignee

Unassigned

Reporter

Konrad Windszus

Labels

None

Components

Priority

Major