Last updated by burtbeckwith 1 year ago

Grails 1.3 Milestone 1 Release Notes

SpringSource are pleased to announce the 1.3 Milestone 1 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:

Groovy 1.7 Support

Grails 1.3 Milestone 1 comes with the recently released 1.7 version of the Groovy language, which includes loads of new features like anonymous and nested class support, power asserts and more. See the Groovy 1.7 release notes for info.

JUnit 4

Grails 1.3 now uses JUnit 4 to run tests. JUnit 4 features a richer assertion API and many features like timeouts, ignores, class level before and after methods, hamcrest matchers, assumptions, theories and more.

Pre Grails 1.3 tests are fully backwards compatible.

Maven Repository Support

Grails now has full support for publishing plugins to (using the maven publisher plugin) and reading plugins from Maven compatible repositories.

You can easily configure additional plugin repositories in BuildConfig.groovy using the Ivy DSL introduced in Grails 1.2:

repositories {
   mavenRepo "http://repository.codehaus.org"
}

The central Grails repository can also now be easily enabled and disabled by including using the grailsCentral method:

repositories {
   grailsCentral()
}

Declarative Plugin Dependencies

Alongside the new Maven repository support you can now declare plugin dependencies using the Ivy DSL:

plugins {
   runtime ':hibernate:1.2.1'
}

Which allows you to easily control plugin exclusions:

plugins {
   runtime( ':weceem:0.8' ) {
      excludes "searchable"
   }
}

And the scope of a plugin:

plugins {
   build( ':weceem:0.8' ) 
}

Dirty Checking in GORM

GORM includes new methods to check whether an object has been modified:

def airport = Airport.get(10)
assert !airport.isDirty()

airport.properties = params if (airport.isDirty()) { // do something based on changed state }

You can also check if individual fields have been modified:

def airport = Airport.get(10)
assert !airport.isDirty()

airport.properties = params if (airport.isDirty('name')) { // do something based on changed name }

GORM Support For Derived Properties

GORM now provides a mechanism for taking advantage of Hibernate's derived properties support.

class Product {
   Float price
   Float finalPrice

static mapping = { finalPrice formula: 'PRICE * 1.155' } }

Named Queries Support Additional Criteria

Additional criteria may be supplied to named queries at invocation time:

class Publication {
    String title
    String author
    Date datePublished
    Integer numberOfPages

static namedQueries = { recentPublications { def now = new Date() gt 'datePublished', now - 365 } } }

def books = Publication.recentPublications {
    or {
        like 'author', 'Tony%'
        like 'author', 'Phil%'
    }
}

New GSP Tag - join

<g:join in="['Grails', 'Groovy', 'Gradle']" delimiter="_"/>

Produces:

Grails_Groovy_Gradle