0

In Eclipse, expand current project in project explorer,

click Java Resources -> libraries -> Maven Dependencies

And I found there are two jar files which in different version, i.e.:

commons-lang-2.1.jar
and
commons-lang3-3.1.jar

but from pom.xml, I cannot tell where commons-lang-2.1.jar come from as it must required by one of the artifacts. But it is too much trouble to check pom file from each artifact...

I heard of dependency-tree can work something similar but don't know how to make it work under this situation. Any hint is appreciated.

Dreamer
  • 7,333
  • 24
  • 99
  • 179
  • Actually maven has its own library folder and it is capable of download missing libraries from internet when compiling. – libik Mar 24 '14 at 17:34
  • @libik The question is what's requiring those versions. – Dave Newton Mar 24 '14 at 17:36
  • 1
    Show in Eclipse. First click on the pom.xml file and than on the Tab "Dependency hierarchy" should give you information from where such elements are comming. – khmarbaise Mar 24 '14 at 17:39

2 Answers2

2
mvn dependency:tree

Look for the two instances of commons-lang and see what requires them.

That said, the two versions aren't compatible, and can live in the same application:

http://commons.apache.org/proper/commons-lang/article3_0.html

See this answer of mine regarding deciphering the tree output. The nutshell is that indented libraries are dependencies of the non-indented library above it: a dependency tree.

Community
  • 1
  • 1
Dave Newton
  • 158,873
  • 26
  • 254
  • 302
2

execute

mvn dependency:tree

if you have very giant dependency tree and hard to read you can use

mvn dependency:tree -Dincludes=org.apache.commons:commons-lang3

to just include occurrence of this artifact

from your pom.xml it will list out all the dependencies being pulled directly or indirectly, and put the <exclusion> to avoid consumption of non desired library

jmj
  • 237,923
  • 42
  • 401
  • 438