Reference

Community

Grails 1.1 Beta 3 Release Notes

29th of January 2009

SpringSource and the Grails development team are pleased to announce the 1.1 beta 3 release of the Grails web application development framework.

Grails is a dynamic web application framework built on Java and Groovy, leveraging best of breed APIs from the Java EE sphere including Spring, Hibernate and SiteMesh. Grails brings to Java and Groovy developers the joys of convention-based rapid development while allowing them to leverage their existing knowledge and capitalize on the proven and performant APIs Java developers have been using for years.

Further information about the release can be obtained using the links below:

Enhanced Enum Support

Enum types can now specify a getId() method that GORM will call to persist the state of an enum. This an alternative to using either the Enum name or the ordinal value to persist an enums state.

enum Country {
AUSTRIA('at'),
UNITED_STATES('us'),
GERMANY('de');

finalString id

Country(String id) { this.id = id }
}

Plugins

Global Plugins

Plugins can now be installed globally for all applications:

grails install-plugin webtest -global

Multiple Plugin Repositories

Grails now supports the ability to configure multiple plugin repositories by providing a USER_HOME/.grails/settings.groovy file or a grails-app/conf/BuildConfig.groovy file that contains the configured repository details:

The Grails plugin discovery commands like list-plugin and install-plugin will then automatically work against all configured repositories. To release a plugin to a specific repository you can use the repository argument:

grails release-plugin -repository=myRepository

Automatic Transitive Plugin Resolution

Plugins no longer need to be checked into SVN and will automatically be installed via a plugins metadata when the application is first loaded.

In addition, plugin dependencies are now resolved transitively.

Plugin Scopes and Environments

Plugins can now be scoped using either the environment or predefined build scopes:

def environments = ['dev', 'test']
def scopes = [excludes:'war']

The plugins will only load in those environments and will not be packaged into the WAR file. This allows "development-only" plugins to not be packaged for production use.

Modular Application Development with Plugins

An application can now load plugins from anywhere on the file system, even if they have not been installed. Simply add the location of the (unpacked) plugin to you BuildConfig.groovy file:

Data Binding

Data Binding a Subset of Properties

It is now simpler to bind data to a subset of properties. Previously you could use the syntax:

person.properties = params

Which 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 operator:

person.properties["firstName","lastName"] = params

And access a subset of the domain classes properties using the same syntax:

person.properties["firstName","lastName"].each { println it }

Data Binding for Collection Types

Grails now supports data binding to collections types including lists, sets and maps.

Server Side Includes

There is a new <g:include> tag that can be used to include the response of another controller, action or view inside the current view:

<g:include controller="book" action="list"></g:include>

This can also be used from a controller or another tag library:

def content = include(controller:"book", action:"list")

Performance Improvements

GSPs now render an order of maginitude faster than they used to do resulting in an overall performance boost for Grails applications.

Project Infrastructure

Maven integration

Grails 1.1 comes with an associated Maven plugin and archetype that allows you to build your Grails project easily using Maven. Follow the instructions here and either use the archetype to create a new Grails project, or run:

mvn grails:create-pom

to create a Maven POM for an existing project.

Ant + Ivy Integration

Grails now creates an Ant build.xml and corresponding ivy.xml file for each project allowing you to build a Grails project on any build server that supports Ant (like CruiseControl and Hudson) without needing Grails installed on the target server.

Spring Namespace Support in BeanBuilder

Grails' Spring DSL has been extended to include access to the Spring namespace APIs allowing you to easily use Spring advanced AOP support (among other things):

Upgrade notes

Grails 1.1 has a number of changes, but should be mostly backwards compatible with 1.0.x series applications. If you have issues please report them. The following is a list of known issues that need to be considered when upgrading

Plugins are now stored in your USER_HOME directory. You will need to re-install your plugins or run:

grails -Dgrails.plugins.dir=./plugins run-app

Enums are now mapped onto the database with String values instead of ordinals by default