maven - How to find which dependency is pulling in a particular class file? -


my project consists of dependencies pulling same common dependency.

the common dependency storm-kafka has new version 1.0.2 , old version 0.10.0

on building shaded jar, see classes both versions in fat jar , somehow during execution, older 1 getting picked gives classnotfounderror because other dependencies related older version not there.

jar -xvf my_shaded_fat_jar.jar find . -name keyvalueschemeasmultischeme.class ./org/apache/storm/kafka/keyvalueschemeasmultischeme.class ./storm/kafka/keyvalueschemeasmultischeme.class 

storm/kafka older 1 , org/apache/storm/kafka new 1 want.

surprising part not see 0.10.0 in ~/.m2 repo:

ls ~/.m2/repository/org/apache/storm/storm-kafka/ 1.0.2 # no 0.10.0 here ! 

how debug maven find out older dependency creeping into?

edit:

on running mvn dependency:tree -dverbose -dincludes=storm.kafka, get:

[warning] pom org.apache.storm:flux-core:jar:1.0.2 invalid, transitive dependencies (if any) not available, enable debug logging more details [warning] pom org.apache.storm:storm-kafka:jar:1.0.2 invalid, transitive dependencies (if any) not available, enable debug logging more details [info]  [info] --- maven-dependency-plugin:2.8:tree (default-cli)  --- [warning] failed build parent project org.apache.storm:flux-core:jar:1.0.2 [warning] invalid pom org.apache.storm:flux-core:jar:1.0.2, transitive dependencies (if any) not available, enable debug logging more details [warning] invalid pom org.apache.storm:storm-kafka:jar:1.0.2, transitive dependencies (if any) not available, enable debug logging more details [warning] failed build parent project org.apache.storm:flux-core:jar:1.0.2 [warning] invalid pom org.apache.storm:flux-core:jar:1.0.2, transitive dependencies (if any) not available, enable debug logging more details 

why poms invalid? cleaned .m2 repo removing in ~/.m2/repository/org/apache/storm

you can use maven tree goal show dependencies used. prints out full dep tree default can find particular dependency you're interested in - example try:

mvn dependency:tree -dverbose -dincludes=storm.kafka

to see what's pulling in kafka. more info can found here:

http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -