Getting into dependency and avoiding dependency hell

As you use a number of dependencies, each of them in turn may also include further dependencies. A situation may come when there are multiple versions of the same dependencies in the project. This can often lead to errors.

Getting ready

To understand this, we need to have a fairly complex project that has several transitive dependencies. You can look at one such project at https://github.com/selendroid/demoproject-selendroid.

Clone the repository on your system. Now, we are ready to see how complex dependencies can get.

How to do it...

Use the following steps to avoid dependency hell:

  1. Run the following command:
    mvn dependency:tree -Dverbose
    
  2. Note the output as shown in the following screenshot:

How it ...

Get Apache Maven Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.