How to get all the dependencies/dependency tree of a maven project (direct dependencies and indirect dependencies)?

        If you want to get the list of direct and indirect dependencies in a maven project, you can use the command

mvn dependency:tree

How to Execute:

You can run mvn dependency:tree on the command line like below. You should be in the same folder where pom.xml exists. 

What is the use?

       Knowing the list of all the dependencies in a maven project is helpful if you want to exclude some indirect dependencies. 

For example, you have added a dependency in your project which internally fetches a log back dependency with version 1.2. But if you want to use the log back dependency with version 1.3, then you need to find out which dependency caused this and you have to exclude this.

Later you can add the log back dependency with version 1.3.