13 November 2008

How to find and list transitive dependency in Maven

Note: I have modified this post as per Brian's comment below.

Maven packs the transitive dependencies into the archive files. We can exclude specific transitive dependencies by using <exclusions>
To list transitive dependencies that are packed into the archive file, there is maven-dependency-plugin.

Invoke any of the maven life cycle phase like mvn install dependency:tree

To write the dependency content into a file, we can use
mvn install dependency:tree -outputFile=dependency.txt

A sample output is shown in the screenshot below