MathJax

SyntaxHighlighter

Highlight

Custom CSS

Wednesday, November 3, 2010

Showing transitive dependencies with Leiningen

When you specify a dependency on a Java library in Leiningen, you might pull in all sorts of random transitive dependencies (eg there are no less than three logging frameworks/facades that could be pulled in). Figuring out which artifacts pull in those transitive dependencies is a snap in Leiningen; just do this:

# Generate a pom for Maven to parse
lein pom
# Create a dependency tree with Maven
mvn dependency:tree

You'll get some output that looks like this:

[INFO] +- org.clojure:clojure:jar:1.2.0:compile
[INFO] +- org.clojure:clojure-contrib:jar:1.2.0:compile
[INFO] +- org.clojars.sids:htmlcleaner:jar:2.1:compile
[INFO] +- commons-lang:commons-lang:jar:2.5:compile
[INFO] +- commons-io:commons-io:jar:1.4:compile
[INFO] +- clj-file-utils:clj-file-utils:jar:0.1.2:compile
[INFO] +- log4j:log4j:jar:1.2.15:compile
[INFO] +- lein-daemon:lein-daemon:jar:0.2.1:compile
[INFO] |  \- commons-daemon:commons-daemon:jar:1.0.1:compile
[INFO] +- org.apache.hadoop:hadoop-core:jar:0.20.2-dev:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.0.4:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.4.3:runtime
[INFO] |  +- org.slf4j:slf4j-log4j12:jar:1.4.3:runtime
[INFO] |  +- commons-httpclient:commons-httpclient:jar:3.1:runtime
[INFO] |  +- commons-cli:commons-cli:jar:1.2:compile
[INFO] |  +- commons-net:commons-net:jar:1.4.1:runtime
[INFO] |  |  \- oro:oro:jar:2.0.8:runtime
[INFO] |  +- javax.servlet:servlet-api:jar:2.5:runtime
[INFO] |  +- org.mortbay.jetty:jetty:jar:6.1.14:compile
[INFO] |  |  +- org.mortbay.jetty:jetty-util:jar:6.1.14:compile
[INFO] |  |  \- org.mortbay.jetty:servlet-api-2.5:jar:6.1.14:compile
[INFO] |  +- org.mortbay.jetty:jsp-2.1:jar:6.1.14:compile
[INFO] |  |  +- org.eclipse.jdt:core:jar:3.1.1:compile
[INFO] |  |  \- ant:ant:jar:1.6.5:compile
[INFO] |  +- org.mortbay.jetty:jsp-api-2.1:jar:6.1.14:compile
[INFO] |  +- commons-el:commons-el:jar:1.0:runtime
[INFO] |  +- org.apache.ant:ant:jar:1.7.0:runtime
[INFO] |  |  \- org.apache.ant:ant-launcher:jar:1.7.0:runtime
[INFO] |  +- net.java.dev.jets3t:jets3t:jar:0.6.1:runtime
[INFO] |  \- xmlenc:xmlenc:jar:0.52:runtime
[INFO] \- clj-http:clj-http:jar:0.1.1:compile
[INFO]    +- org.apache.httpcomponents:httpclient:jar:4.0.1:compile
[INFO]    |  \- org.apache.httpcomponents:httpcore:jar:4.0.1:compile
[INFO]    \- commons-codec:commons-codec:jar:1.4:compile

Easy peasy.
Post a Comment