1.3 What's new in Grails 2.1? 2.3.8

See the light - agile, industrial strength, rapid web application development made easy

(Quick Reference) # 1.3 What's new in Grails 2.1? - Reference Documentation Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari Version: 2.3.8 ## 1.3 What's new in Grails 2.1? #### Maven Improvements / Multi Module Build Support Grails' Maven support has been improved in a number of significant ways. Firstly it is now possible to specify plugins within your `pom.xml` file:
    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>hibernate</artifactId>
        <version>2.1.0</version>
        <type>zip</type>
        <scope>compile</scope>
    </dependency>
The Maven plugin now resolves plugins as well as jar dependencies (previously jar dependencies were resolved by Maven and plugins by Ivy). Ivy is completely disabled leaving all dependency resolution up to Maven ensuring that evictions work as expected. There is also a new Grails `create-multi-project-build` script which features initial support for Maven (Gradle coming in a future release). This script can be run from a parent directory containing Grails applications and plugins and it will generate a Maven multi-module build. Enabling Maven in a project has been made easier with the inclusion of the `create-pom` command:
    grails create-app myapp
    cd myapp
    grails create-pom com.mycompany
    mvn package
To create a multi-module Maven build follow these steps:
    grails create-app myapp
    grails create-plugin plugin-a
    grails create-plugin plugin-b
    grails create-multi-project-build com.mycompany:parent:1.0-SNAPSHOT
    mvn install
#### Grails Wrapper The Grails Wrapper allows a Grails application to build without having to install Grails and configure a GRAILS_HOME environment variable. The wrapper includes a small shell script and a couple of small bootstrap jar files that typically would be checked in to source code control along with the rest of the project. The first time the wrapper is executed it will download and configure a Grails installation. This wrapper makes it more simple to setup a development environment, configure CI and manage upgrades to future versions of Grails. When the application is upgraded to the next version of Grails, the wrapper is updated and checked in to the source code control system and the next time developers update their workspace and run the wrapper, they will automatically be using the correct version of Grails. See the Wrapper Documentation for more details. #### Debug Option The `grails` command now supports a `-debug` option which will startup the remote debug agent. This behavior used to be provided by the `grails-debug` command. `grails-debug` is still available but is deprecated and may be removed from a future release.
    grails -debug run-app
#### Grails Command Aliases The `alias` command may be used to define aliases for grails commands. The following command creates an alias named `rit` (short for "run integration tests"):
    grails alias rit test-app integration:
See the alias docs for more info. #### Cache Plugin Grails 2.1 installs the cache plugin by default. This plugin provides powerful and easy to use cache functionality to applications and plugins. The main plugin provides basic map backed caching support. For more robust caching options one of the implementation plugins should be installed and configured. See the cache-redis docs and the cache-ehcache docs for details. See the main plugin documentation for details on how to configure and use the plugin. #### New GORM Methods In Grails 2.1.1 domain classes now have static methods named `first` and `last` to retrieve the first and last instances from the datastore. See the first and last documentation for details. | Quick Reference (hide)