Friday 4 September 2020

mvn dependency:tree - rescuer during build issues

Maven is one of the very good build tools and is still popular among many users. Even though we use it for a long time, we use to remember or use only a limited number of its commands like 'mvn clean install', 'mvn package', mvn test' etc

we get to know many of its commands only when we face issues, one of the nice command is the 'mvn dependency:tree' to get all the dependencies including the transitive dependencies we have. In this blog, I am going to talk about this particular command

We should execute the below command from the folder where we have the pom.xml file

$ mvn dependency:tree

This will print all the dependencies from the root till the last jar, this will help to identify what are the transitive dependencies that we have.

We have varieties of options to fix the transitive deps error, 

1. Add the transitive dependency into <exclusions> list

If you have control over the dependency then you can do one of the following

2.  make the transitive deps in the provided scope https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope

No comments:

Post a Comment