Maven依赖冲突(Wicket&x2B;Spring&x2B;Hibernate/ASM)
我目前正在将Wicket项目从Wicket版本1.4.2升级到6.4.0。wicket组件/页面的迁移进行得很顺利,但我遇到了projet依赖项的问题 这是一个老项目,依靠老技术和私有框架。我的公司框架目前无法升级,所以我必须处理它的特殊性 当我将我的webapp部署到Glassfish时,出现以下错误:Maven依赖冲突(Wicket&x2B;Spring&x2B;Hibernate/ASM),hibernate,maven,dependencies,wicket,Hibernate,Maven,Dependencies,Wicket,我目前正在将Wicket项目从Wicket版本1.4.2升级到6.4.0。wicket组件/页面的迁移进行得很顺利,但我遇到了projet依赖项的问题 这是一个老项目,依靠老技术和私有框架。我的公司框架目前无法升级,所以我必须处理它的特殊性 当我将我的webapp部署到Glassfish时,出现以下错误: ERROR - ContextLoader - Context initialization failed org.springframework.beans.fac
ERROR - ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [jar:file:/home/company/glassfish/domains/domain1/applications/j2ee-modules/mainProject-3.0.0-SNAPSHOT/WEB-INF/lib/daoProject-3.0.0-SNAPSHOT.jar!/dataContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V
是否有解决此类依赖关系冲突的“最佳实践”?我尝试了几件事(从privateFramework
中排除asm
,使用dependencyManagement
,…)强制asm到3.3.1),但我无法让它工作
谢谢您可以尝试将
cglib:cglib
的范围设置为提供的
(这样它就不会添加到WAR文件中),并改用cglib:cglib nodep
。此cglib发行版嵌入了asm的“着色”版本(基本包已更改),从而避免了冲突
将此添加到您的POM中:
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2.2</version>
</dependency>
cglib
cglib
2.2.2
假如
cglib
cglibnodep
2.2.2
<dependency>
<groupId>my.company</groupId>
<artifactId>privateFramework</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-hibernate3</artifactId>
<version>2.0.8</version>
</dependency>
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ immatriculation ---
[INFO] my.company:mainProject:war:3.0.0-SNAPSHOT
[INFO] +- my.company:privateFramework:jar:1.1.6:compile
[INFO] | \- org.springframework:spring-hibernate3:jar:2.0.8:compile
[INFO] | \- org.hibernate:hibernate:jar:3.2.5.ga:compile
[INFO] | +- asm:asm-attrs:jar:1.5.3:compile
[INFO] | \- asm:asm:jar:1.5.3:compile
[INFO] \- org.apache.wicket:wicket-spring:jar:6.4.0:compile
[INFO] \- org.apache.wicket:wicket-ioc:jar:6.4.0:compile
[INFO] \- cglib:cglib:jar:2.2.2:compile
[INFO] \- (asm:asm:jar:3.3.1:compile - omitted for conflict with 1.5.3)
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2.2</version>
</dependency>