Loading...

List dependency tree in Apache Maven

Do you ever run into the situation that a open source library uses a logging framework and you don’t know which one? If you use Apache Maven as build tool, the easiest solution is just to invoke mvn dependency:tree.

It will give for instance this output:

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ terminal-watcher ---
[INFO] net.cinhtau.ao:terminal-watcher:jar:1.0-SNAPSHOT
[INFO] +- org.elasticsearch.client:transport:jar:5.0.0:compile
[INFO] |  +- org.elasticsearch:elasticsearch:jar:5.0.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-core:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-analyzers-common:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-backward-codecs:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-grouping:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-highlighter:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-join:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-memory:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-misc:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-queries:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-queryparser:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-sandbox:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-spatial:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-spatial-extras:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-spatial3d:jar:6.2.0:compile
[INFO] |  |  +- org.apache.lucene:lucene-suggest:jar:6.2.0:compile
[INFO] |  |  +- org.elasticsearch:securesm:jar:1.1:compile
[INFO] |  |  +- net.sf.jopt-simple:jopt-simple:jar:5.0.2:compile
[INFO] |  |  +- com.carrotsearch:hppc:jar:0.7.1:compile
[INFO] |  |  +- joda-time:joda-time:jar:2.9.4:compile
[INFO] |  |  +- org.joda:joda-convert:jar:1.2:compile
[INFO] |  |  +- org.yaml:snakeyaml:jar:1.15:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-core:jar:2.8.1:compile
[INFO] |  |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.8.1:compile
[INFO] |  |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.8.1:compile
[INFO] |  |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.8.1:compile
[INFO] |  |  +- com.tdunning:t-digest:jar:3.0:compile
[INFO] |  |  +- org.hdrhistogram:HdrHistogram:jar:2.1.6:compile
[INFO] |  |  \- net.java.dev.jna:jna:jar:4.2.2:compile
[INFO] |  +- org.elasticsearch.plugin:transport-netty3-client:jar:5.0.0:compile
[INFO] |  |  \- io.netty:netty:jar:3.10.6.Final:compile
[INFO] |  +- org.elasticsearch.plugin:transport-netty4-client:jar:5.0.0:compile
[INFO] |  |  +- io.netty:netty-buffer:jar:4.1.5.Final:compile
[INFO] |  |  +- io.netty:netty-codec:jar:4.1.5.Final:compile
[INFO] |  |  +- io.netty:netty-codec-http:jar:4.1.5.Final:compile
[INFO] |  |  +- io.netty:netty-common:jar:4.1.5.Final:compile
[INFO] |  |  +- io.netty:netty-handler:jar:4.1.5.Final:compile
[INFO] |  |  +- io.netty:netty-resolver:jar:4.1.5.Final:compile
[INFO] |  |  \- io.netty:netty-transport:jar:4.1.5.Final:compile
[INFO] |  +- org.elasticsearch.plugin:reindex-client:jar:5.0.0:compile
[INFO] |  |  \- org.elasticsearch.client:rest:jar:5.0.0:compile
[INFO] |  |     +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] |  |     +- org.apache.httpcomponents:httpcore:jar:4.4.5:compile
[INFO] |  |     +- org.apache.httpcomponents:httpasyncclient:jar:4.1.2:compile
[INFO] |  |     +- org.apache.httpcomponents:httpcore-nio:jar:4.4.5:compile
[INFO] |  |     +- commons-codec:commons-codec:jar:1.10:compile
[INFO] |  |     \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] |  +- org.elasticsearch.plugin:lang-mustache-client:jar:5.0.0:compile
[INFO] |  |  \- com.github.spullara.mustache.java:compiler:jar:0.9.3:compile
[INFO] |  \- org.elasticsearch.plugin:percolator-client:jar:5.0.0:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.7:compile
[INFO] |  \- org.apache.logging.log4j:log4j-api:jar:2.7:compile
[INFO] \- org.apache.logging.log4j:log4j-core:jar:2.7:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.050 s
[INFO] Finished at: 2016-11-04T17:03:45+01:00
[INFO] Final Memory: 18M/211M
[INFO] ------------------------------------------------------------------------

You can see that log4j version 2.7 is used :wink: .