How to find which dependency is pulling in a particular class file?
<p>My project consists of some dependencies which are pulling the same common dependency.</p>

<p>The common dependency <code>storm-kafka</code> has a new version 1.0.2 and an old version 0.10.0</p>

<p>On building a shaded jar, I see classes from both the versions in my fat jar and somehow during execution, the older one is getting picked up which gives a <code>ClassNotFoundError</code> because other dependencies related to the older version are not there.</p>

<pre><code>jar -xvf my_shaded_fat_jar.jar
find . -name KeyValueSchemeAsMultiScheme.class
./org/apache/storm/kafka/KeyValueSchemeAsMultiScheme.class
./storm/kafka/KeyValueSchemeAsMultiScheme.class
</code></pre>

<p><code>storm/kafka</code> is older one and <code>org/apache/storm/kafka</code> is the new one I want.</p>

<p>Surprising part is that I do not see 0.10.0 in my <code>~/.m2</code> repo:</p>

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

<p>How do I debug maven to find out from where the older dependency is creeping into?</p>

<p>EDIT:</p>

<p>On running <code>mvn dependency:tree -Dverbose -Dincludes=storm.kafka</code>,  I get:</p>

<pre><code>[WARNING] The POM for org.apache.storm:flux-core:jar:1.0.2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.storm:storm-kafka:jar:1.0.2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli)  ---
[WARNING] Failed to build parent project for org.apache.storm:flux-core:jar:1.0.2
[WARNING] Invalid POM for org.apache.storm:flux-core:jar:1.0.2, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] Invalid POM for org.apache.storm:storm-kafka:jar:1.0.2, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] Failed to build parent project for org.apache.storm:flux-core:jar:1.0.2
[WARNING] Invalid POM for org.apache.storm:flux-core:jar:1.0.2, transitive dependencies (if any) will not be available, enable debug logging for more details
</code></pre>

<p>Why the poms are invalid?
I just cleaned my <code>.m2</code> repo by removing everything in <code>~/.m2/repository/org/apache/storm</code></p>