Home:ALL Converter>Transitive scope in maven for provided and runtime

Transitive scope in maven for provided and runtime

Ask Time:2019-06-27T22:31:12         Author:Number945

Json Formatter

According to maven resolution of transitive scope ,

If A be our project which have a direct dependency on X whose scope is provided with respect to A.

Maven tells that any dependency (direct or transitive) of X with scope runtime will be resolved to scope provided w.r.t A.

Let Y be a direct dependency of X with scope runtime w.r.t to X.

A --> X(scope = provided) --> Y(scope = runtime)

Now, Y will resolved to provided scope w.r.t to A.

Observation : Y will never be needed in runtime classpath of A. It will be needed only in test classpath of A. In fact , if you take Y as transitive dependency of X keeping its scope as runtime only, still it will never be used in A's runtime classpath. It will be used only in test classpath.

Question : So, should not we say -

If A be our project which have a direct dependency on X whose scope is provided with respect to A , then any dependency (direct or transitive) of X with scope runtime will be resolved to scope test w.r.t A ?

Author:Number945,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/56793310/transitive-scope-in-maven-for-provided-and-runtime
yy