Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display complete dependency tree with Leiningen

I understand that lein deps :tree displays a dependency tree of all the project dependencies (implicit and explicit). However, "each dependency is only shown once within a tree." I'd really like to see a tree where this wasn't the case, and that if libraries A and B require library X, library X shows up under both A and B.

Does anyone know how to do this with lein or some other tool?

like image 376
metasoarous Avatar asked Oct 13 '15 03:10

metasoarous


People also ask

What does Lein Deps :tree display?

I understand that lein deps :tree displays a dependency tree of all the project dependencies (implicit and explicit). However, "each dependency is only shown once within a tree."

How to generate Maven's pom using Leiningen?

This can now be done using leiningen by lein deps :tree. Note the space between deps and :tree. Show activity on this post. You can generate Maven's POM out of Leiningen's project definition and then use Maven's dependency:tree plugin with a verbose option, like this:

How do I include or exclude specific dependencies in a tree?

This is where the maven dependency plugin comes into the resue. dependency:tree comes with two filters to help us include or exclude specific dependencies while displaying the tree. We can use the includes filter to specify a list of artifacts to include in the dependency hierarchy.

How to display the Maven dependencies tree in Eclipse?

Displaying the maven dependencies tree in Eclipse is pretty simple and takes less than 10 seconds. To accomplish that, we need to open the pom.xml of our project and then click on the Dependency Hierarchy tab: Sometimes, we may find ourselves working on a project that uses a lot of dependencies. So, managing all of them can be a real nightmare.


1 Answers

You can generate Maven's POM out of Leiningen's project definition and then use Maven's dependency:tree plugin with a verbose option, like this:

$ lein pom $ mvn dependency:tree -Dverbose=true  

This will list dependencies omitted for various reasons, e.g.:

|  +- ring:ring-core:jar:1.4.0:compile |  |  +- (org.clojure:clojure:jar:1.5.1:compile - omitted for conflict with 1.7.0) |  |  +- (org.clojure:tools.reader:jar:0.9.1:compile - omitted for conflict with 0.10.0-alpha3) |  |  +- (ring:ring-codec:jar:1.0.0:compile - omitted for duplicate) 

For more options to dependency:tree see its documentation.

like image 92
siphiuel Avatar answered Sep 22 '22 14:09

siphiuel