Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 
like image 565
genonymous Avatar asked Nov 30 '15 19:11

genonymous


People also ask

How do you analyze a dependency tree in Maven?

A project's dependency tree can be filtered to locate specific dependencies. For example, to find out why Velocity is being used by the Maven Dependency Plugin, we can execute the following in the project's directory: mvn dependency:tree -Dincludes=velocity:velocity.

How do I run a dependency tree command in Maven?

How to get the Maven Dependency Tree of a Project. We can run mvn dependency:tree command in the terminal to print the project dependency tree. For our example, I will be using the Mockito Tutorial project. You can download the project from the GitHub repository.

How does a dependency tree work?

mvn dependency:tree CommandThe main purpose of the dependency:tree goal is to display in form of a tree view all the dependencies of a given project. As we can see, maven prints the dependencies tree of our project.


1 Answers

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).

like image 111
Tunaki Avatar answered Sep 20 '22 07:09

Tunaki