github grails/grails-core v1.3
Grails 1.3.0

latest releases: v6.2.0, v4.1.4, v6.1.2...
9 years ago

11th of May 2010

SpringSource are pleased to announce the 1.3 release of the Grails web application development framework.

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

Groovy 1.7 Support

Grails 1.3 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.

Improvements to Modular Plugin Development

There are a couple of significant improvements to modular application development with plugins:

  • You can now override any plugin provides class, view or template simply by creating an equivalent class (same package/class name) or GSP in your application
  • You now no longer need to run package-plugin in each inline plugin prior to using or building a WAR file

Maven Repository Support

Grails now has full support for publishing plugins to (using the [maven publisher|http://grails.org/plugin/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|http://grails.org/plugin/home] 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%'
     }
 }

Chaining Named Criteria

Named criteria may be chained together. When criteria are chained together, the query will be generated
as if all of the chained criteria had been combined in a single criteria closure.

 // recent publications with 'Book' in the title
 def books = Publication.recentPublications.publicationsWithBookInTitle.list()

 // old publications with more than 500 pages and with 'Book' in the title
 def books = Publication.oldPublicationsLargerThan(500).publicationsWithBookInTitle.list()

Global application layouts

You can now define a layout to be used by all pages that don't specifiy one otherwise by creating a @grails-app/views/layouts/application.gsp@ file. The name of the layout to use can also be modified in Config.groovy:

 grails.sitemesh.default.layout='myLayoutName'

New GSP Tag - join

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

Produces:

 Grails_Groovy_Gradle

PDF Publishing for Grails doc

The 'grails doc' command can now produce a PDF document from your user documentation sources:

 grails doc --pdf

An easy way to create a template grails doc project has also been introduced:

 grails doc --init

Don't miss a new grails-core release

NewReleases is sending notifications on new releases.