Press enter to see results or esc to cancel.

How to find project dependencies in a Maven project

cog-wheels
It’s very useful to be able to see what is included in your class path especially when you’re trying to track down a troublesome dependency. Recently I had an issue with a JDOM dependency; however I had not defined a JDOM dependency in my pom.xml file and I couldn’t quite figure out why this dependency existed. This is where Maven’s excellent dependency plugin comes to the rescue.

In a project you may have dependencies on libraries like Log4J or Freemarker. These libraries in their turn may have dependencies on other libraries, this is also known as transitive dependencies.

Using the following Maven command we’ll be able to see a list of these dependencies:

mvn dependency:resolve

For a nice tree view of the same information use:

mvn dependency:tree

If you want to see a full dependency trail that also show you artifacts that were rejected due to conflicts or other reasons then run maven with the debug flag enabled:

mvn install -X

For more information about the Maven dependency plugin go here: http://maven.apache.org/plugins/maven-dependency-plugin/