title: How to Use a Specific Version of GORM in Grails® 3 date: April 27, 2016
description: Learn how you can enforce a particular GORM version in Grails 3. author: Graeme Rocher image: 2016-04-27.jpg CSS: [%url]/stylesheets/prism.css JAVASCRIPT: [%url]/javascripts/prism.js

[%title]

[%author]

[%date]

Tags: #gorm

In order to ensure compatibility Grails® 3 ships with a BOM that applies dependency management and enforces a particular version of GORM when using Grails.

Sometimes however, you want to use a different version or there is a more recent version of GORM out there that you would prefer to use.

Luckily Gradle makes this fairly easy to control. Using the following snippet you can enforce a particular GORM version within your build.gradle:

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        if (details.requested.group == 'org.grails' 
        && details.requested.name.startsWith('grails-datastore')) {
            details.useVersion("5.0.5.RELEASE")
        }
    }        
}

In this example I’m forcing Gradle to resolve the 5.0.5.RELEASE version of GORM using the Gradle resolutionStrategy.