Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<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?

like image 973
Johan Avatar asked May 16 '26 22:05

Johan


1 Answers

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.

like image 91
J Fabian Meier Avatar answered May 18 '26 13:05

J Fabian Meier