Skip to content

Commit

Permalink
Recommend users to directly specify dependencies when using them dire…
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlinp authored and hboutemy committed Jan 15, 2019
1 parent 4f85af2 commit 15cdcc9
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ Introduction to the Dependency Mechanism

[]

Although transitive dependencies can help you to include desired dependencies, it is a good practice that you directly
specify the dependencies you are directly using in your own source code. This best practice proves its value especially
when the dependencies of your project constantly changes their dependencies. Assume that your project A specifies a
dependency on another project B, and project B specifies a dependency on project C. If you are directly using components
in project C, and you don't specify project C in your project A, it may cause build failure when project B suddenly
updates/removes its dependency on project C. Another reason to directly specify dependencies is that it provides better
documentation for your project: one can learn more information by just reading the POM file in your project. Maven also
provides a plugin {{{https://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html}dependency:analyze mojo}}
for analyzing the dependencies and making this best practice more achievable.

* {Dependency Scope}

Dependency scope is used to limit the transitivity of a dependency, and also to affect the classpath used for
Expand Down

0 comments on commit 15cdcc9

Please sign in to comment.