我正在使用 Grails,并且有一个本地插件(我编写的),我正在将其与我的项目结合使用。本地插件位置是使用 grails.plugin.location 配置参数在 BuildConfig.groovy 中配置的。
在 Grails 1.3.3 中,该插件工作正常,但是自从升级到 Grails 1.3.5 后,当我尝试运行该插件的脚本之一时,出现以下错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager': Invocation of init method failed; nested exception is java.io.FileNotFoundException: web-app\WEB-INF\grails.xml (The system cannot find the file specified)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
我相信 grails.xml 文件(它声称缺少)是自动生成的 - 并且该问题可能与问题 GRAILS-6601 有关。 (但是,这在 1.3.5 中已修复)。
无论如何,我的问题似乎是由于 Grails 1.3.3 和 1.3.5 之间 _GrailsBootstrap.groovy 脚本的更改而发生的。比较 1.3.3 和 1.3.5 之间的这些脚本,我注意到脚本的一个新的 pluginManager 部分如下:
// There is a pluginManager variable in the binding
delegate."pluginManager"(GrailsPluginManagerFactoryBean) {
application = grailsApplication
grailsDescriptor = new FileSystemResource("web-app/WEB-INF/grails.xml")
}
这在 Grails 1.3.3 的等效脚本中不存在,并且似乎导致了我的问题。我查看了发行说明和其他信息,但无法找到是否需要配置一些新内容才能使本地插件正常工作。
有什么办法可以避免这个错误吗?这是配置问题吗?如果是,我缺少什么?
最佳答案
以下方法从 1.1.1 到现在 1.3.6 一直适用于我们。在BuildConfig.groovy
中,写入:
grails.plugin.location.'my-plugin-name' = "local-plugins/my-plugin-name-0.1"
关于grails - 如何在 grails 1.3.5 中运行本地插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4964741/