Friday, May 11, 2012

install-plugin not working for local targets in Grails 2.0.3

Just a note for anyone coming across this error:

After getting the JsLint for Grails plugin to work (see the previous post) I noticed there was some easy cleanup I could do on the plugin code. It was a good opportunity to get my feet wet with plugin development.

In the process I learnt that the grails command install-plugin does not work for local plugin targets as specified in the documentation, resulting in a failure to resolve dependency/null pointer error.

  ::::::::::::::::::::::::::::::::::::::::::::::
  ::          UNRESOLVED DEPENDENCIES         ::
  ::::::::::::::::::::::::::::::::::::::::::::::
  :: org.grails.plugins#jslint;0.4: java.lang.NullPointerException at org.apache.ivy.plugins.resolver.AbstractResolver.initRepositoryCacheManagerFromSettings(AbstractResolver.java:396)
  ::::::::::::::::::::::::::::::::::::::::::::::

After quite a bit of Googling I found a comment from a Grails contributor that the feature was actually broken and will produce an error in Grails 2.1 when that is released. He also point referred to a useful section of the documentation that described how to reference a local, unpackaged plugin from one project to another during plugin development, which solved my requirement quite handily:

// Useful to test plugins you are developing.
grails.plugin.location.shiro =
        "/home/dilbert/dev/plugins/grails-shiro"
// Useful for modular applications where all plugins and
// applications are in the same directory.
grails.plugin.location.'grails-ui' = "../grails-grails-ui"

(See Specifying Plugin Locations in the same section of the documentation)


No comments:

Post a Comment