Reputation: 67494
I've got this problem and I think it's caused by some library transitively depending on an old version velocity. My pom is explicitly asking for the correct version of velocity, but I think some other dependency is transitively pulling in an old version of velocity and this is being used in my classpath instead.
I'm aware of mvn dependency:tree
, but on a complex project, this can output a very tall, difficult to read tree. It's more thinking than I'd like to figure out what's depending on velocity 1.5, for example.
So I figured, "grep to the rescue". But that didn't help because I got this output:
$ mvn dependency:tree | grep velocity
[INFO] | | +- velocity:velocity:jar:1.5:compile
[INFO] | | | +- velocity:velocity:jar:1.5:compile
[INFO] | | | +- velocity:velocity:jar:1.5:compile
[INFO] +- org.apache.velocity:velocity:jar:1.6.3:compile
[INFO] +- org.apache.velocity:velocity-tools:jar:2.0:compile
[INFO] | +- velocity:velocity:jar:1.5:compile
[INFO] | | +- velocity:velocity:jar:1.5:compile
[INFO] +- org.apache.velocity:velocity-tools:jar:2.0:compile
[INFO] | \- org.apache.velocity:velocity:jar:1.6.3:compile (version managed from 1.6.2)
[INFO] | | | +- velocity:velocity:jar:1.5:compile
[INFO] | +- org.apache.velocity:velocity-tools:jar:2.0:provided
[INFO] | | \- org.apache.velocity:velocity:jar:1.6.3:provided (version managed from 1.6.2)
[INFO] | | | +- velocity:velocity:jar:1.5:provided
[INFO] | +- org.apache.velocity:velocity-tools:jar:2.0:provided
[INFO] | | \- org.apache.velocity:velocity:jar:1.6.3:provided (version managed from 1.6.2)
[INFO] | +- org.apache.velocity:velocity-tools:jar:2.0:provided
[INFO] | | \- org.apache.velocity:velocity:jar:1.6.3:provided (version managed from 1.6.2)
[INFO] | | | +- velocity:velocity:jar:1.5:compile
[INFO] | +- org.apache.velocity:velocity:jar:1.6.3:compile (version managed from 1.6.3)
[INFO] | +- org.apache.velocity:velocity-tools:jar:2.0:compile (version managed from 2.0)
[INFO] | | +- velocity:velocity:jar:1.5:compile
I can't tell what's really depending on that first velocity 1.5 there. Does maven provide some arguments to dependency:tree
to make my life easier? Or is there some neat trick I can use with the shell commands to figure this out? I'm using cygwin btw, but I'm hoping that doesn't matter since it has most of those commands available.
Upvotes: 2
Views: 4823
Reputation: 8324
cheffe's answer is a good one.
To add to this, another solution I use often involves egrep
, basically when I want to see the bigger picture.
mvn dependency:tree -Dverbose | egrep --color 'velocity|$'
Pros:
Cons:
Upvotes: 1
Reputation: 9500
I think this should help you (taken from Resolving conflicts using the dependency tree)
mvn dependency:tree -Dverbose -Dincludes=velocity
If that does not help I'd prefer filtering on dependency over grep (taken from Filtering the dependency tree)
mvn dependency:tree -Dincludes=velocity:velocity
Upvotes: 4