My project consists of some dependencies which are pulling the same common dependency.
The common dependency storm-kafka
has a new version 1.0.2 and an old version 0.10.0
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 ClassNotFoundError
because other dependencies related to the older version are 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
is older one and org/apache/storm/kafka
is the new one I want.
Surprising part is that I do not see 0.10.0 in my ~/.m2
repo:
ls ~/.m2/repository/org/apache/storm/storm-kafka/
1.0.2
# no 0.10.0 here !
How do I debug maven to find out from where the older dependency is creeping into?
EDIT:
On running mvn dependency:tree -Dverbose -Dincludes=storm.kafka
, I get:
[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
Why the poms are invalid?
I just cleaned my .m2
repo by removing everything in ~/.m2/repository/org/apache/storm