Johan
Johan

Reputation: 3819

<runtime> Maven dependencies transitivity

Think to a dependency tree like A-->B-->C. Assume that B is compile within A.

If C has a compile scope within B then, when compiling A, C will be included to the A's classpath.

If C has a provided scope within B then, when compiling A, C will NOT be included to the A's classpath unless A declares C e.g. as a compile dependency.

If C has a runtime scope within B, when running A in a devoted container, will C be available to the A's classpath?

Upvotes: 3

Views: 1763

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35893

Assuming A->B is "compile", it will be a runtime dependency for A. This is explained in the table (scroll down):

https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

It pretty much summarizes the whole transitivity/scope problem.

Upvotes: 4

Related Questions