Custom Search

Friday, June 28, 2013

Chcek maven dependyncy or jar conflicts - mvn dependency:tree or mvn dependency:tree -Dverbose : is used to see/verify the dependency between jars in Maven for your project dir

Maven command
mvn dependency:tree  is used to see/verify the dependency between jars used in a particular project.

To run above command, navigate to your project directory and where you have the pom.xml file for the project you want to verify the jar dependencies:
For example, like
# cd /opt/cas-workspace/local-cas

Thats the location of my workspace, containing my projects pom file.

[root@www local-cas]# ls -l
total 20
-rw-r--r-- 1 root root 8795 Jun 25 11:33 pom.xml
drwxr-xr-x 3 root root 4096 Jun  5 07:33 src
drwxr-xr-x 5 root root 4096 Jun 25 11:57 target

So, now you can run the mvn dependency:tree command.
# mvn dependency:tree

or specifically if you know which jar you are getting loaded as extra then you can filter it to look for that particular jar by providing its groupId and artifactId and its version (all are option values):

> mvn dependency:tree -Dincludes=org.slf4j:slf4j-api:1.4.2

where the above format is :  mvn dependency:tree -Dincludes=[groupId]:[artifactId]:[version]

To look for a particular jar files groupId and its artifact you can search on below sites:

Also you can use:
# mvn dependency:tree -Dverbose

In verbose mode the dependency tree shows dependencies that were omitted for: being a duplicate of another; conflicting with another's version and/or scope


No comments:

Post a Comment