How to get a dependency tree for an artifact?

0 votes
asked Jul 27, 2010 by ittayd

dependency:tree can be used to see the dependency tree for a given project. But what I need is to see the dependency tree for a 3rd party artifact.

I guess I can create an empty project, but I'm looking for something easier (I need to do this for several artifacts).

6 Answers

0 votes
answered Jul 27, 2010 by amra

1) Use maven dependency plugin

Create a simple project with pom.xml only. Add your dependency and run:

mvn dependency:tree

Unfortunately dependency mojo must use pom.xml or you get following error:

Cannot execute mojo: tree. It requires a project with an existing pom.xml, but the build is not using one.

2) Find pom.xml of your artifact in maven central repository

Dependencies are described In pom.xml of your artifact. Find it using maven infrastructure.

Go to and enter your groupId and artifactId.

Or you can go to and navigate first using plugins groupId, later using artifactId and finally using its version.

For example see org.springframework:spring-core

3) Use maven dependency plugin against your artifact

Part of dependency artifact is a pom.xml. That specifies it's dependency. And you can execute mvn dependency:tree on this pom.

0 votes
answered Jul 27, 2010 by sean-patrick-floyd

If you use a current version of m2eclipse (which you should if you use eclipse and maven):

Select the menu entry

Navigate -> Open Maven POM

and enter the artifact you are looking for.

The pom will open in the pom editor, from which you can select the tab Dependency Hierarchy to view the dependency hierarchy (as the name suggests :-) )

0 votes
answered Jul 27, 2010 by pascal-thivent

If your artifact is not a dependency of a given project, your best bet is to use a repository search engine. Many of them describes the dependencies of a given artifact.

0 votes
answered Jul 27, 2015 by adamw

If you'd like to get a graphical, searchable representation of the dependency tree (including all modules from your project, transitive dependencies and eviction information), check out UpdateImpact: (free service).

Disclaimer: I'm one of the developers of the site

0 votes
answered Jul 28, 2015 by matthias

The solution is to call dependency:tree with the artifact's pom.xml file:

mvn -f "$HOME/.m2/repository/$POM_PATH" dependency:tree

See also How to list the transitive dependencies of an artifact from a repository?

0 votes
answered Jul 13, 2016 by kayvan-tehrani

You can search for an artifact using this maven command:

mvn dependency:tree -Dincludes=DESIRED-groupId:DESIRED-artifactId

Imagine you are trying to find 'log4j-1.2-api' jar file among your project:

mvn dependency:tree -Dincludes=org.apache.logging.log4j:log4j-1.2-api

more information can be found here.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter