问题描述
最初,我在项目的pom.xml文件中具有3.2版asm的maven依赖关系.我使用以下依赖项将其更新到版本4.1
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
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>4.1</version>
<scope>compile</scope>
</dependency>
但是现在我的项目在WEB-INF/lib中都有两个jar文件-asm 3.2和asm 4.1.我需要一些asm 4.1功能,但是由于两个jar都可用,因此使用了asm 3.2代码,因此无法使用asm 4.1功能.
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.
推荐答案
asm
3.2的依赖项是:
The dependency for asm
3.2 is:
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.2</version>
</dependency>
请注意,组ID不匹配.可能发生的情况是您的另一个依赖项正在加载asm
3.2作为传递性依赖项.由于组ID的差异,Maven的依赖项解析过程无法确定4.1版本应该替代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.
您需要做的是取消3.2版本.首先通过运行mvn dependency:tree
或使用Eclipse POM编辑器的依赖关系层次结构"选项卡,找出导致Maven将其引入的依赖关系.然后在您的POM中找到该依赖项并添加一个排除项:
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:
<dependency>
<groupId>some.group.id</groupId>
<artifactId>dependency-pulling-in-asm</artifactId>
<version>1.0</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
</exclusions>
</dependency>
Maven文档对此进行了解释
这篇关于Maven在存储库中保留了较早版本的asm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!