Friday, August 10, 2012

Learned a interesting lesson with Grails today.....

Learned a interesting lesson with Grails today..... NEVER give plugins a name in all caps(Or more than 1 capital letter in a row). I had 2 plugins I made, called 'SPP' and 'RFCORE' which (due to JIRA wanting to name the svn repos this way) cause an interesting breakdown in Grails. I publish these plugins to Artifactory via the release plugin in Grails, and bind them to the app in the plugins {} closure. The other day I added my fork of Weceem (I fixed it to work on Oracle and send a pull request back to them) to the plugins{} block. Works fine via inline plugin mode with my (all caps) plugin names. Once I deploy a WAR file, suddenly Grails has no idea where my plugins are (war is made, however the plugins are missing from the war). What threw me off was that if I uninstall the weceem plugin, my (all caps) plugins are now built into the war. So I step through the code in the Grails PluginBuildSettings class in the method 'getSupportedPluginInfos' and find that the plugin registry has my plugins like this 'SPP-0.1-SNAPSHOT' but the maven resolution is looking for them as 'spp-0.1-SNAPSHOT' and automatically lower casing it for me. If those don't match (it is case sensitive, I personally think it should not be), Grails acts like the plugin basically doesn't exist and doesn't package it up. Now I refactor my plugin class files from SSPGrailsPlugin to sppGrailsPlugin and it works. I'm not sure if this is a bug in Grails (2.x) or not, or it just doesn't support plugins with more than one capital letter in a row in it. If it's a bug I can patch it and submit a pull request. Moral of the story, don't make Grails plugins with more than 1 capital letter in a row, or you will spend all day figuring out what is going wrong ;)

1 comment:

robin aggarwal said...

your new lesson is very good for me,thanks to share your blog post.
Grails Technology