Initially, I had the maven dependency for asm version 3.2 in pom.xml file of my project. I update the same to version 4.1 using the following dependency
org.ow2.asm
asm
4.1
compile
but now my project has both jar files in WEB-INF/lib - asm 3.2 and asm 4.1. I need some features of asm 4.1 but due to both jars being available asm 3.2 code is used because of which I cannot use the asm 4.1 feature.
Any help in this matter is appreciated.
解决方案
The dependency for asm 3.2 is:
asm
asm
3.2
Note the group IDs do not match. What is likely happening is that another of your dependencies is loading asm 3.2 as a transitive dependency. Maven's dependency resolution process cannot determine that the 4.1 version is supposed to override the 3.2 version due to the group ID difference, and there is a problem.
What you need to do is eliminate the 3.2 version. First figure out which dependency is causing Maven to pull it in, by running mvn dependency:tree or using the Eclipse POM editor's dependency hierarchy tab. Then find that dependency in your POM and add an exclusion:
some.group.id
dependency-pulling-in-asm
1.0
compile
asm
asm
Maven documentation explains this further.