Updated Grails Console Plugin

I’ve released an update to the Grails Console Plugin, version 1.0.1 (there was a bug affecting Grails 1.1 in the 1.0 release). The original authors (Siegfried Puchbauer and Mingfai Ma) aren’t working on it anymore and allowed me to do a release with some changes I had made.

I had been using a modified version of the plugin for a while and finally got around to contributing the changes back. The version I was using was storing the Groovy shell in the user’s HTTP session but this caused problems when clustering since it’s not serializable. This had been fixed in a more recent release however, so the changes I ended up making were mostly cosmetic.

I reworked the GSP, controller and service to be more modular, and split out the Javascript from the GSP into a .js file. In addition I upgraded CodeMirror to the latest version, and switched from Prototype to jQuery (and removed unreleased YUI-based code and other unused files). To customize the console view you can copy the plugin’s GSP (grails-app/views/console/index.gsp) to your application and it’ll be used instead.


Having a console like this available in a running Grails application is very useful. Since it’s running in the same process as your Grails app, it has access to GORM domain classes, services, and everything else in your application. So doing a quick database query, calling a service method or just testing some code is possible without restarting the application or running the standard Swing-based console.

It’s even useful in production, although since this is a very dangerous feature to have in a live web site it’s important to restrict access to it. My preference would be the Spring Security Core plugin since you can restrict it by role (e.g. ROLE_ADMIN) but also by IP address.

I wrote a while back about using a similar console to patch a bug in a running server.

If you have any questions or suggestions send a note to the Grails User mailing list, and report bugs in JIRA under the Grails-Console component.

3 Responses to “Updated Grails Console Plugin”

  1. Jean barmash says:

    Hi Burt,

    Excited about the update – I also use the console plugin on daily basis. For the old version, I had a local customization that allowed me to open up a file and run that as my script. That allows to run it on my dev machine but save the code that runs in a file. I’ll try to get that ported to the new version (though some of that need was precipitated by the way the old version used to lock out the user from copying the script on failure – I think the new version is more forgiving).

  2. Burt says:

    @Jean sounds great – send it along

  3. […] informaciĆ³n sobre Updated Grails Console Plugin (traducido al […]

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.