在我的 grails 2.3.4 应用程序中(从 grails 2.2.3 升级后),当我运行 grails 命令行时grails install-plugin pluginname
出现以下错误,即使我尝试grails list-plugins
我也得到了同样的错误:
Error Resolve error obtaining dependencies: Failed to resolve dependencies (Se log level to 'warn' in BuildConfig.groovy for more information): org.grails.plugins:tomcat:2.3.4 (Use --stacktrace to see the full trace)
我回顾了 BuildConfig.groovy 没有 tomcat 2.3.4 我使用的是 7.0.47,这是我的插件:
runtime ":hibernate:3.6.10.6"
runtime ":jquery:1.8.3"
runtime :resources:1.1.6
build ":tomcat:7.0.47"
runtime database-migration:1.2.1
compile :cache:1.0.1
我该如何解决这个问题?
你的问题似乎很可爱,因为......您需要先清理 Grails 项目而不构建它,然后再执行
grails refresh-dependencies
然后最后
grails clean
和
grails compile
当你运行refresh-dependencies
你的Grails应用程序将尝试解析文件中定义的BuildConfig.groovy
grails插件。如果这不起作用,请删除插件并执行上述步骤,直到您在问题中发布的错误消失,然后添加具有正确优先级依赖项的正确插件格式和版本,然后确保一切正常。
您的依赖项位于依赖项块中,但它们是插件。将它们放在BuildConfig.groovy
文件的插件块中。因此,与其拥有什么,不如放这个:
plugins {
runtime ":hibernate:3.6.10.6"
runtime ":jquery:1.8.3"
runtime ":resources:1.1.6"
build ":tomcat:7.0.47"
runtime ":database-migration:1.2.1"
compile ":cache:1.0.1"
}
此外,这不是"依赖"块。但是,这是一个依赖项块。有关 Grails 中的依赖关系解析的信息,请参阅此链接。
我需要在buildconfig.groovy中添加以下存储库到存储库部分:
mavenRepo "https://repo.grails.org/grails/plugins"