【问题标题】:How to run a local plugin in grails 1.3.5如何在 grails 1.3.5 中运行本地插件
【发布时间】:2011-02-11 01:30:59
【问题描述】:

我正在使用 Grails,并且我有一个本地插件(我编写的),我将它与我的项目结合使用。本地插件位置在 BuildConfig.groovy 中使用 grails.plugin.location 配置参数进行配置。

在 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 中的等效脚本中不存在,似乎是导致我的问题的原因。我查看了发行说明和其他信息,但无法找到是否需要配置新内容才能使本地插件正常工作。

有什么办法可以避免这个错误吗?是否是配置问题,如果是,我缺少什么?

【问题讨论】:

  • 您是否尝试过重新安装插件?

标签: grails grails-plugin


【解决方案1】:

从 1.1.1 到现在,1.3.6,以下方法一直为我们工作。在BuildConfig.groovy,写:

grails.plugin.location.'my-plugin-name' = "local-plugins/my-plugin-name-0.1"

【讨论】:

  • 谢谢 - 但这就是我一直在做的 - 以及我的查询第一行的意思,我说它是“使用 grails.plugin.location 在 BuildConfig 中配置的”参数。我得到的错误似乎不是没有设置这个 (grails.plugin.location.'my-plugin-name') 的结果,因为它在 1.3.3 中工作并且该值仍然是(如据我所知)设置正确。此外,如果我 grails-upgrade 回到 1.3.3,插件可以正常工作,没有错误。
  • 哦,对不起,我明白了。还有一条愚蠢的评论——你试过grails clean吗?
  • 只是为了澄清任何人在将来检查这个,我终于使用“grails clean”和删除以前生成的资源/重建项目等的组合来完成这个工作。我不确定到底是什么最初导致问题 - 单独的 grails clean 并不能解决它 - 但是我接受了@Victor的回答,因为您确实需要设置“grails.plugin.location.blah”并且他对“grails clean”的建议确实帮助了我最终到达那里!
  • 嗯,有时需要擦除 $HOME/.grails//plugins 或 /projects/。不知道具体时间。
猜你喜欢
  • 2011-12-30
  • 2011-05-22
  • 1970-01-01
  • 2011-04-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多