Glennn
Glennn

Reputation: 467

How to run a local plugin in grails 1.3.5

I'm using Grails and I have a local-plugin (that I wrote) that I'm using in conjunction with my project. The local plugin location is configured in BuildConfig.groovy using the grails.plugin.location config parameter.

In Grails 1.3.3, the plugin worked fine, however since upgrading to Grails 1.3.5 I get the following error when I attempt to run one of the plugin's scripts:

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)

I believe that the grails.xml file (which it claims is missing) is generated automatically - and the problem may be related to issue GRAILS-6601 (however, this was fixed in 1.3.5).

In any case, my problem seems to have occurred due to a change in the _GrailsBootstrap.groovy script between Grails 1.3.3 and 1.3.5. Comparing these scripts between 1.3.3 and 1.3.5, I note that a new pluginManager part of the script reads:

// There is a pluginManager variable in the binding
            delegate."pluginManager"(GrailsPluginManagerFactoryBean) {
                application = grailsApplication
                grailsDescriptor = new FileSystemResource("web-app/WEB-INF/grails.xml")
            }

This is not present in the equivalent script in Grails 1.3.3 and seems to be causing my problem. I've looked at the release notes and other information, and haven't been able to find if there's something new I need to configure to make local plugins work.

Any ideas how I can avoid this error? Is it a configuration issue, and if so, what am I missing?

Upvotes: 2

Views: 1543

Answers (1)

Victor Sergienko
Victor Sergienko

Reputation: 13475

The following approach used to work for us since 1.1.1 till now, 1.3.6. In BuildConfig.groovy, write:

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

Upvotes: 3

Related Questions