Posts

Showing posts from January, 2016

Using Maven Dependency Tree in troubleshooting

In this blog post, I'm going to explain how to check the  maven dependency tree and how it is useful in troubleshooting certain run time exception which we might encounter while running Spring applications.

Maven Dependency resolution:
When you use maven, it uses its own dependency resolution mechanism to decide which jar to use when there is a conflict. Lets say you are using two dependencies, each of which have the same jar. Now, unless you pay attention, maven might end up using the incorrect jar version, and you will start getting exceptions like 'ClassNotFound' or 'NoSuchMethodError'.

So, it helps to know which version of jar has maven resolved and is added to our application. This is where the Maven dependency tree helps us.


Maven Dependency Tree:
A simple command, "mvn dependency:tree -Dverbose " will print out the entire maven dependency tree.

I will show with an example how to analyze this tree. Since is based on a issue I recently faced, I hope it will…