Subscribe: Graeme Rocher's Blog
Added By: Feedage Forager Feedage Grade B rated
Language: English
blog  book  code locale  code  grails  groovy grails  groovy  locale  maven  new  plugin  spring  springsource  support 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Graeme Rocher's Blog

Graeme Rocher's Blog

Thought's about software, Grails, Java, web development and anything else that comes to mind.

Updated: 2017-09-05T22:37:44.022+01:00




This blog has moved home to Tumblr.

Grails 2.0 Released!


Long time no post, but after lots of hard work from the Grails core team we are pleased to announce the Grails 2.0 release.

I have posted a comprehensive announcement on the SpringSource blog.


Grails on Cloud Foundry


For those of you who missed it, yesterday we launched the new Cloud
which we hope will become the premier deployment model for
Grails (and Spring, Ruby, Node etc.) applications in the the
future. If you missed the presentation checkout the YouTube recording.

It represents the culmination of a huge amount of work within VMware and we're super excited about the potential it has to completely revolutionize deployment models for Grails applications in the future.

Here are some further resources specific to Grails users:

Wiki & Sample applications:
Plugin Documentation:

Signups are currently on a first come first serve basis under a limited beta programme.

Reading i18n messages from the database with Grails


In a recent consulting engagement, a client wanted to know how to go about reading i18n messages from the database rather than static properties files (the default in Grails). Considering how easy this is to do I was surprised when I Googled it that there was no information on how this is achieved.Anyway it's dead simple. Just create a domain class that models a message:class Message { String code Locale locale String text }Then implement a class that extends the class. In the example below I am using simple GORM finders to lookup a message using the code and localeclass DatabaseMessageSource extends AbstractMessageSource { protected MessageFormat resolveCode(String code, Locale locale) { Message msg = Message.findByCodeAndLocale(code, locale) def format if(msg) { format = new MessageFormat(msg.text, msg.locale) } else { format = new MessageFormat(code, locale ) } return format; } }Then wire it in using Spring by configuring a "messageSource" bean in the grails-app/conf/spring/resources.groovy file:beans = { messageSource(DatabaseMessageSource) }And that's it. Now you're serving messages from the database. Of course this is a terrible inefficient implementation since we're hitting the database for ever message code used in the application. However, it's pretty easy to introduce caching. Just create a cache key:@Immutable class MessageKey implements Serializable { String code Locale locale }Then configure an appropriate cache bean (I'm using Ehcache) in Spring and wire it into your MessageSource:beans = { messageCache(EhCacheFactoryBean) { timeToLive = 500 // other cache properties } messageSource(DatabaseMessageSource) { messageCache = messageCache } }Finally, update your implementation to use caching:class DatabaseMessageSource extends AbstractMessageSource { Ehcache messageCache @Override protected MessageFormat resolveCode(String code, Locale locale) { def key = new MessageKey(code,locale) def format = messageCache.get(key)?.value if(!format) { Message msg = Message.findByCodeAndLocale(code, locale) if(msg) { format = new MessageFormat(msg.text, msg.locale) } else { format = new MessageFormat(code, locale) } messageCache.put new Element(key, format) return format } return format; } }[...]

Grails - dependency resolution done right


Over the past couple of weeks I have been working on improving Grails dependency resolution capabilities for both applications and plugins. In previous versions of Grails (1.1 and below) you had limited options when it came to dependency resolution.

You could use the Grails Maven plugin, but that forced you to use, heavin forbid, Maven. We also shipped with basic Ant + Ivy support, but it was only really designed to be used for automation with continuous integration servers that support Ant and not at development time.

With Grails 1.2 this all changes with the introduction of Grails' dependency resolution DSL, which you can use to define your dependencies. Built on Ivy we have now eliminated one of the last remnants of XML usage in the Grails framework:
    dependencies {
runtime 'com.mysql:mysql-connector-java:5.1.5'
test 'junit:junit:3.8.2'
Grails takes application defined dependencies (defined in grails-app/conf/BuildConfig.groovy) and merges them with dependencies defined in the framework or any installed plugins. If there are conflicts you can exclude dependencies inherited from the framework or you can override plugin dependencies.

By default Grails will only resolve dependencies against your Grails installation but you can enable remote repository resolution easily:
repositories {
mavenRepo ""
If you're addicted to your pom.xml file then we have even added the ability to read dependencies from the pom.xml instead of using the DSL. All in all, Grails 1.2 will give you significantly better control over dependencies and how they are resolved.

We're still on track to release Grails 1.2 by the end of the month, but if you want to hear more about it I'll be talking about Grails 1.2 at upcoming events such as JAOO (Denmark), SpringOne2GX (New Orleans, USA) and the Grails eXchange (London). See you there!

Grails 1.1.1, Gr8conf, AppEngine and other happenings


Just got back from Gr8conf and really had a blast. It was a nice small group of 90-100 which meant you could really have a lot of one on one time with many of the attendees who had questions. The sessions were also not too short. Having that extra bit of time to elaborate on things makes a real different compared to the 45 minute rush you have at JavaOne et al.

All in all it felt more like a No Fluff event, which can only be described as a good thing. Right before the conference we released Grails 1.1.1 which is mainly a bug fix release, but the exciting part is the new Google AppEngine plugin which works with Grails 1.1.1

The plugin takes the heavy lifting out of configuring a Grails application for usage on AppEngine by automatically configuring the AppEngine development environment and a JDO persistence layer (JPA is coming too soon). You get reloading out of the box too, so Grails + AppEngine is really the most productive environment for developing JVM applications for AppEngine.

One missing feature from the AppEngine support right now is GORM (you have to use the raw JDO APIs). However, we are hard at work developing GORM-JPA (and potentially GORM-JDO) which will bring most of the features of GORM on top of standard JPA.

GORM-JPA is not the only exciting thing happening right now in the Grails plugin front. We are working with Adobe on integrating Flex and BlazeDS closely with Spring. The results of that can be seen in the recent Spring/BlazeDS integration 1.0 Rc2 release. The next phase is to build on top of that for the Grails plugin which is on my todo list to complete soon. Exciting times.

The plugin community itself continues to flourish, checkout these:
  • It is now finally possible to write Grails applications for different Portals such as Liferay and Pluto thanks to the Portlets plugins.
  • There is an excellent new plugin that embeds an LDAP server into Grails for easily testing LDAP
  • The Flex Scaffold plugin let's you generated complete CRUD applications using Grails and Adobe Flex
  • The Build Test Data plugin let's you quickly create dummy test data
  • Using the Spring WS plugin writing SOAP web services, feels more like writing REST service. Easy and painless.
These are just a few isolated mentions, there is activity going on all the time on the plugin space.

Grails 1.1 Released


Yes! Grails 1.1 is out and available for download. Checkout my blog post on the SpringSource team blog for a more detailed overview of the highlights. It is a strange feeling after a release goes out, like a mixture of relief, happiness and that "ok what now" feeling. Maybe I take software too seriously :-|

Nice to see how Twitter is abuzz with the news (note live results, link will change overtime) right now. Other than that we are now planning the launch of the plugin portal. To support that I have been writing a few plugins for Grails. It is niceto actually write Grails apps/plugins rather than work on the internals all the time.

Anyway the result is 2 new plugins called Commentable and Taggable that allow you to generically tag and comment on domain instances. I also have a new blog plugin in the works which will power the new blog when that is ready. Actually its already available, but I need to document it better, and I'll save that for another post.

As for beyond Grails 1.1, we are now at the planning phase, but there are loads of things we are considering from OSGi to JCR to Cloud computing. Exciting times.

Grails at the London Java WUG


I'll be doing a talk at the London Java Web User Group on Building Twitter with Grails in 40 Minutes on Monday the 16th of February. If you want to come a long you need to register ASAP, the last talk I did we had to turn away people as we could only fit 70 in the room.

See you there!

Grails Happenings: 1.1, Wired, Book etc.


Regular readers, I must apologize for the relative lack of updates compared to 2008, but it seems I have caught the Twitter bug, where you can get more frequent ramblings of my activities.

Nevertheless, we are progressing well with Grails 1.1 which should be out this month. Loads of exciting stuff is on the way and I am really happy with what we have achieved. The Groovy 1.6 + Grails 1.1 combination is going to be a great one.

In other news we (SpringSource) have done a case study with about their usage of Grails. We hope to put out more case studies and white papers in the future about Grails for those looking to convince their managers that Grails is the way to go. You can download the case study here.

In other news InfoQ has a nice article up about Grails and Dynamic Jasper. For thsoe of you who don't know, InfoQ are also the organizers of QCon, which I will be speaking at in March. I'll also be doing a half day Groovy/Grails workshop at the JavaOne University this year if you're looking for a more comprehensive engagement.

Finally, Jeff and I completed The Definitive Guide to Grails, Second Edition which is a complete re-write (and a heftier one at that) of the original book with up-t0-date information covering Grails 1.0 and many of the features of Grails 1.1.

Grails & Maven Kiss and Make-up with Grails 1.1 Beta 2


So Grails 1.1 Beta 2 is out. Rejoice! There are many new features that are detailed in the release notes. However, one of the main ones in this beta is the new support for Maven.

Regular readers of my blog will probably be aware of my long history as one who, ahem, is not particularily fond of Maven. Granted I am still not particularily fond of Maven, but it is the Christmas period and in the spirit of "why can't we all just get a long" I am proud to say that Grails integrates nicely with Maven now :-)

Peter Ledbrook, core Grails committers, has been tirelessly working away at making the Grails + Maven experience a seamless one. I personally even went as far as installing Maven 2 onto my machine, which was a huge jump for me I can tell you, and I can tell you Peter's done a great job!

As ever we encourage Maven users to give the Maven integration a go and report any issues that you may have with it in JIRA. Enjoy!

Grails + Spring Integration


Regular readers will recall I mentioned in my announcement of the SpringSource acquisition of G2One that the potential to integrate Grails with more Spring portfolio products is huge. Well, SpringSource colleague Russ Miles has taken the first steps in integrating Grails with Spring Integration 1.0.

For those of you who don't know, Spring Integration is a lightweight way to do message passing through endpoints in a similar way to some of the big ESBs. The article is a precursor to even more exciting stuff involving Spring Integration being made available as a Grails plugin. Watch this space.

Interview with me on Grails Podcast


Those crazy guys over at the Grails podcast interviewed me about various things ranging from being part of SpringSource to the upcoming Grails 1.1 release to my deep hatred of all things Maven. Check it out.

Groovy and Grails join the Spring family


You may have already read about it in the various news outlets and blogs covering the announcement, but if you haven’t I’m excited to spread the word that G2One - The Groovy/Grails company - has been acquired by SpringSource. The result is that Groovy and Grails join the growing number of excellent Open Source projects delivered by SpringSource.

The Spring Framework really pioneered simplified development on the Java platform. A philosophy that is the very essence of Grails. Both frameworks aggressively try to makes the lives of developers easier. The Spring Framework provides an abstraction layer of common Java enterprise APIs, whilst Grails uses the Groovy dynamic language to further simplify Spring and Java. In this sense Grails fits perfectly into SpringSource’s philosophy.

On the Grails front this is great news at multiple levels. With Grails already being based on Spring, users of Grails now have access to expertise about not only Grails, but also Spring, the framework that underpins all of Grails. Grails will benefit further from tighter integration with the Spring Framework with exciting integration possibilities on the horizon between Grails and great Spring portfolio products like Spring Batch, Spring Integration and SpringSource dm Server.

Grails will benefit from greater visibility and wider adoption simply by being under the SpringSource umbrella. In addition, SpringSource will bring all their expertise around Eclipse plugin development ensuring that users of Groovy and Grails have a first class experience in the Eclipse IDE.

At SpringSource, there is a lot of excitement about Groovy and Grails. Grails adds that little bit of Web 2.0 spice to the company and provides yet another avenue for users to adopt the Spring Framework. We’re literally buzzing with ideas on how Spring, Groovy and Grails can be integrated in the future and look forward to the feedback of the respective communities.

I personally will continue to lead Grails at SpringSource, whilst Guillaume remains the project lead of Groovy. The majority of the former G2One team have taken up positions at SpringSource. On the topic of Guillaume, he is as excited about this development as I am and has a great post on the benefits of the acquisition to Groovy. Check it out!


Couple of nice Grails UI articles


Matt Taylor has posted a couple of nice articles demonstrating how to use GrailsUI's dataTable component. Cool stuff.

GrailsUI 1.0 Released


Over the past few months we've had a lot of demand from different clients for a UI component library for Grails, built and supported by G2One. Thanks to a great collaborative effort, GrailsUI 1.0 is now available built on the excellent Yahoo UI library.

Matthew Taylor, G2One Software Engineer and the lead of the GrailsUI project, has the lowdown on what is on offer. Check it out!

New GORM Features Coming in 1.1


Now that The Definitive Guide to Grails 2nd Edition (barring a few reviews) is a wrap, I've been refocusing in Grails development. First up, is GORM and we've implemented a number of great improvements including:Better GORM eventsPreviously, GORM supported beforeInsert, beforeUpdate and beforeDelete events, now there is afterInsert, afterUpdate and afterDelete to complete the picturePersistence of Collections of Basic TypesGORM now supports persisting basic types like String, Integer and so on using a join table:class Person { static hasMany = [nicknames:String]}Improvements to Data BindingIt is now simpler to bind data to a subset of properties. Previously you could use the = paramsWhich would bind all the incoming request parameters to the person. If you didn't want that behavior you could use the bindData method. Now you can bind to a subset of properties using the subscript["firstName","lastName"] = paramsAnd access a subset of the domain classes properties using the same["firstName","lastName"].each { println it }Read-Only Access to ObjectsPersistent instances can now be loaded in a read-only state using the read method:def book = Sort OrderAssociations can now be sorted using a default sort order declared at the class level:class Book {String titlestatic mapping = { sort "title"}}Or at the association level:class Author { static hasMany = [books:Book] static mapping = { books sort:"title" }}Batch FetchingGORM now supports configuring batch fetching (an optimization of lazy loading) using the ORM DSL at the class level:class Book {String titlestatic mapping = { batchSize 15}}Or at the association level:class Author { static hasMany = [books:Book] static mapping = { books batchSize:15 }}Improvements to Dynamic FindersThere is a new InList suffix that can be used with dynamic finders:def groovyBooks = Book.findByAuthorInList(['Dierk Koenig', 'Graeme Rocher'])Dynamic finders can also now use the query cache:def books = Book.findByTitle("Groovy in Action", [cache:true] )And upgrade to a pessimistic lock:def books = Book.findByTitle("Groovy in Action", [lock:true] )Legacy Mapping for Many-to-Many and Unidirectional One-to-manysMany-to-many and Unidirectional One-to-many associations can use the joinTable argument to alter the way they map to the underlying database:class Book { String title static belongsTo = Author static hasMany = [authors:Author] static mapping = { authors joinTable:[name:"mm_author_books", key:'mm_book_id' ] }}class Author { String name static hasMany = [books:Book] static mapping = { books joinTable:[name:"mm_author_books", key:'mm_author_id'] }}[...] relaunches written in Grails


The main portal for Sky television has relaunched written in Grails. Sky, also known as British Sky Broadcasting or BSkyB, employs 17000 people in the UK and operates the largest satellite network in the UK.

The site receives a million+ hits per day and joins all the other subsites also written in Grails:
Congrats to the Sky team!

Update 07/10: Couple of new things have arison since this was posted. Firstly, Sky actually employ 17000 people not 11000. Seems the Google sample data I obtained was out of date.

Also Glenn Saqui has a nice write-up on the architecture of on Marc's Blog. Altogether the 4 subsites listed above receive over 110 million hits per month and run on a cluster of web layer machines and 2 db machines. Checkout the aforementioned link for more info.

Terracotta meets Grails with the Terracotta for Grails plugin


Our busy community of plugin developers have been at it again and now there is a brand new plugin for Grails that adds support for the Terracotta data grid. It was always possible to do this with a bit of manual configuration, but now the plugin automates things nicely using a few new Grails command line scripts.

This is one of the really great things about Grails and Groovy, because Groovy classes are just standard Java classes it is possible to integrate Groovy or Grails applications with any existing Java infrastructure, including data grids like Terracotta and Coherence. Awesome stuff.

Groovy/Grails Community goes wild launches two sites


Wow, the Groovy/Grails community is really getting it together. First we had the launch of, which is a social networking site for Groovy/Grails people to connect with other Groovy/Grails people. The site is built on Grails and its only been up for a few days but aldready over 600 people registered. If you haven't done so do so! The source code for GrailsCrowd is also availabe at Github

Not to be outdown, however, Glen Smith has launched the Groovy Awards ! A site dedicated to nominating the best contributors and to the Groovy / Grails community. Awards up for grabs include Groovy / Grails t-shirts and other goodies. Check it out.

On my front, I know I have been rather inactive posting. Books are really all consuming beasts. I have given a go to twittering now and again about what I'm writing about, although I'm still not sure I "get" twitter.

London Groovy/Grails User Group Meeting - 31st July 2008


I'll be giving a talk on the state of Grails at the London Groovy+Grails user group meeting on the 31st of July. Skills Matter are hosting it as usual, be sure to sign-up here.

Groovy/Grails Training in North America


Apologies for not posting as frequently recently, I've been hard at work on the second edition of "The Definitive Guide to Grails" and also working on feature development for Grails 1.1 (we now have JSP tag library support in GSP and massive improvements to the plug-in system).

Nevertheless, on to the topic of this post, we (G2One Inc - The Groovy/Grails company) have launched our public Groovy & Grails training programme in the US. Announcing this exciting news is Jeff Brown, our main guy in the US, who has this to say:

"Our training events are a fantastic experience. G2One are the folks who lead and sustain the development of both Groovy and Grails. No one understands the technology better than the people who build it. G2One training events give developers an opportunity to spend several days with a technology expert covering everything from fundamentals to advanced language and framework features.

The sessions include a perfect mix of lecture and reinforcing lab work. That hands on approach is a great way for developers to internalize the details. There is no better way to quickly get a team up and running with the technology."

Check it out!

Brian Guan on Grails at LinkedIn


Brian Guan, one of the pioneers of Grails use within LinkedIn, has started a blog series about their experiences with Grails. The first post presents the slides the LinkedIn guys presented at the recent Groovy/Grails meetup at JavaOne. It makes for an interested read so check it out!

Grails 1.0.3 Released


We've just released Grails 1.0.3, which includes 230 issues resolutions and improvements since the last release. The release notes go through the full details, including outlining some of the new features like enum support and interactive mode.

Grails has come a long way, since the release of 1.0 Grails has been downloaded over 186000 times averaging out to around 50000 times per month. That puts it on par or not far behind some of the biggest open source projects like Spring, Hibernate and Struts in terms of downloads.

The most exciting thing for me though is the plug-in community with over 70 plug-ins in the repository some of the new ones include Axis 2 support, Java2D with GraphicsBuilder and profiling (contributed by one of the biggest Grails users LinkedIn) and debugging plug-ins. Awesome stuff.

Now I'm shifting my focus to the second edition of the book, and feature development for Grails 1.1.

Groovy Grails Training From G2One and Callista Enterprise


G2One, Inc. and Callista Enterprise AB have announced a partnership to support Advanced Groovy and Grails training in Scandinavia.

Göteborg 2008-09-08
Stockholm 2008-09-15
Malmö 2008-09-22

The 3 day comprehensive course covers details from intro to advanced for both the Groovy language and the Grails framework. The course description may be found here.

As with all G2One training events, students will receive a free 12 month license for IntelliJ IDEA. IDEA's JetGroovy brings fantastic support for both Groovy and Grails to the IDE.

Please contact us at training at g2one dot com with any training related inquiries.

Grails in Depth slides from JavaOne 08


Although I wasn't able to make JavaOne due to my bought of pneumonia, Guillaume did an excellent job of delivering my presentations and then did everyone a favour by posting them online! Here we go for those who haven't seen them yet:

(object) (embed)