mavendependency-managementmaven-dependency-pluginmaven-dependency

What is the difference between "+-" and "\-" in maven dependency tree output?


If we consider the following example, what is the difference between "+-" and "\-" symbols and what do they signify?

[INFO] [dependency:tree]
[INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT
[INFO] +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4:compile
[INFO] |  \- commons-validator:commons-validator:jar:1.2.0:compile
[INFO] |     \- commons-digester:commons-digester:jar:1.6:compile
[INFO] |        \- (commons-collections:commons-collections:jar:2.1:compile - omitted for conflict with 2.0)
[INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile
[INFO]    \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile
[INFO]       \- commons-collections:commons-collections:jar:2.0:compile

Solution

  • Those symbols do not have any meaning whatsoever, they are just present to read the output of the tree better!

    Here's a more complex output to see better what it does, on a spring-webmvc dependency:

    [INFO] +- org.springframework:spring-webmvc:jar:4.2.2.RELEASE:compile
    [INFO] |  +- org.springframework:spring-beans:jar:4.2.2.RELEASE:compile
    [INFO] |  +- org.springframework:spring-context:jar:4.2.2.RELEASE:compile
    [INFO] |  |  \- org.springframework:spring-aop:jar:4.2.2.RELEASE:compile
    [INFO] |  |     \- aopalliance:aopalliance:jar:1.0:compile
    [INFO] |  +- org.springframework:spring-core:jar:4.2.2.RELEASE:compile
    [INFO] |  |  \- commons-logging:commons-logging:jar:1.2:compile
    [INFO] |  +- org.springframework:spring-expression:jar:4.2.2.RELEASE:compile
    

    Consider the dependency tree as levels: the first level correspond to the direct dependencies; the second level corresponds to the transitive dependencies of those direct dependencies, etc.

    Basically, if there is more than one dependency on the same level for the same artifact, a +- will be shown, otherwise a \- will be shown, indicating an "end" of the tree (i.e. a path leading to a leaf).