spring - Grails 从依赖项中排除 jar

标签 spring grails dependencies

我有一个 grails 2.4.5 项目,其中 BuildConfig.groovy 中的依赖部分为:

dependencies {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
        //compile ":memcached:1.0.3.2"
        //compile ":grails-melody:1.47.2"

        // runtime 'mysql:mysql-connector-java:5.1.16'
        compile "org.grails:grails-core:2.2.2.BUILD-SNAPSHOT", { exclude "grails"}     // added for 2.2.1 support of inner class enums (http://jira.grails.org/browse/GRAILS-9627)

    }
正在运行的程序给出了这个错误:
编译时出现 fatal error org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/C:/Users/Rahulserver/.m2/repository/org/grails/grails-project-api/2.4.5/grails-project-api-2.4.5.jar!/org/codehaus/groovy/grails/compiler/Grailsc.class]; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class我对错误进行了一些研究 java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class并找到here对于上面的 spring 3.2,我们不需要任何 spring-asm 明确。
我的项目的依赖报告显示 org.grails:grails-core:2.2.2.BUILD-SNAPSHOT取决于spring-asm:
+--- org.grails:grails-core:2.2.2.BUILD-20130226.093746-1
|    \--- commons-collections:commons-collections:3.2.1
|    \--- commons-io:commons-io:2.1
|    \--- org.springframework:spring-context:4.0.9.RELEASE
|    \--- org.springframework:spring-beans:4.0.9.RELEASE
|    \--- org.springframework:spring-aspects:3.1.4.RELEASE
|    \--- org.springframework:spring-expression:4.0.9.RELEASE
|    \--- org.springframework:spring-asm:3.1.4.RELEASE
|    \--- org.springframework:spring-context-support:4.0.9.RELEASE
|    \--- org.springframework:spring-core:4.0.9.RELEASE
|    \--- org.springframework:spring-web:4.0.9.RELEASE
|    \--- aopalliance:aopalliance:1.0
|    \--- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final
|    \--- commons-validator:commons-validator:1.3.1
|    \--- org.springframework:spring-aop:4.0.9.RELEASE
那么我应该怎么做才能解决这个冲突呢?有什么办法可以避免
org.springframework:spring-asm:3.1.4.RELEASE 依赖?

最佳答案

在 2.4.5 项目中对 Grails 2.2.x 的依赖是什么?

您在评论中提到的错误已在 2.3-M1 中修复,因此在 2.4.x 中不存在。

我怀疑如果您删除对 grails-core 2.2.2* 的显式依赖,您的错误将会消失。

关于spring - Grails 从依赖项中排除 jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31350043/

相关文章:

powershell - 如何管理多文件 Powershell 模块中脚本之间的依赖关系?

java - 如何使用 Spring Data REST 进行高级搜索?

java - 使用spring jpa编写动态查询的方法

java - Spring Security session 在实例化时抛出错误

java - 如何将 jasperreports 子报表与 grails jasper 插件一起使用?

build - 如何从 TeamCity 中的另一个项目构建项目?

java - Spring Cloud Gateway 用于复合 API 调用?

grails - Grails Spring Security自定义用户详细信息Bean被覆盖

json - 实例上的 Grails 转换器 JSON 编码

java - 您知道任何 Eclipse 插件可以帮助查找项目对 Maven 存储库的依赖关系吗?