This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-site.git
The following commit(s) were added to refs/heads/master by this push: new 79d956f On branch edburns-cognitive-tax-nit-01 Don't make me think: use graphic in addition to text. modified: content/apt/guides/introduction/introduction-to-dependency-mechanism.apt new 43b9453 Merge pull request #184 from edburns/edburns-cognitive-tax-nit-01 79d956f is described below commit 79d956f6a06be8dfb4be37ba8c0779709c73d522 Author: Ed Burns <edbu...@microsoft.com> AuthorDate: Fri Jul 24 17:45:10 2020 -0400 On branch edburns-cognitive-tax-nit-01 Don't make me think: use graphic in addition to text. modified: content/apt/guides/introduction/introduction-to-dependency-mechanism.apt - When reading "A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, then D 1.0 will b" my eyes glazed over. I added a graphic to supplement the existing text. On branch edburns-cognitive-tax-nit-01 Make the ascii graph not have line numbers. modified: content/apt/guides/introduction/introduction-to-dependency-mechanism.apt Mention dependency:tree --- .../introduction-to-dependency-mechanism.apt | 29 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/content/apt/guides/introduction/introduction-to-dependency-mechanism.apt b/content/apt/guides/introduction/introduction-to-dependency-mechanism.apt index c570964..1c0167a 100644 --- a/content/apt/guides/introduction/introduction-to-dependency-mechanism.apt +++ b/content/apt/guides/introduction/introduction-to-dependency-mechanism.apt @@ -75,10 +75,31 @@ Introduction to the Dependency Mechanism Note that if two dependency versions are at the same depth in the dependency tree, the first declaration wins. - * "nearest definition" means that the version used will be the closest one to your project in the tree of dependencies. - For example, if dependencies for A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, + * "nearest definition" means that the version used will be the closest one to your project in the tree of dependencies. Consider this tree of dependencies: + +---- + A + ├── B + │ └── C + │ └── D 2.0 + └── E + └── D 1.0 +---- + + In text, dependencies for A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, then D 1.0 will be used when building A because the path from A to D through E is shorter. - You could explicitly add a dependency to D 2.0 in A to force the use of D 2.0. + You could explicitly add a dependency to D 2.0 in A to force the use of D 2.0, as shown here: + +---- + A + ├── B + │ └── C + │ └── D 2.0 + ├── E + │ └── D 1.0 + │ + └── D 2.0 +---- * <Dependency management> - this allows project authors to directly specify the versions of artifacts to be used when they are encountered @@ -114,7 +135,7 @@ Introduction to the Dependency Mechanism 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. + documentation for your project: one can learn more information by just reading the POM file in your project, or by executing <<mvn dependency:tree>>. Maven also provides {{{/plugins/maven-dependency-plugin/analyze-mojo.html}dependency:analyze}} plugin goal