Posts

Showing posts with the label maven

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

Image
Introduction:         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.

What is Group Id && Artifact Id in a maven project

Image
Artifact is a file, usually a jar. So Artifact Id is the name of the jar. Each artifact id has a group ID (usually a reversed domain name like com.example.foo) for example, in the below dependencies, you can observer that, all artifacts are belong to same groupId. Here groupId is org.slf4j & artifacts have different ids.