How to use a specific version of GORM in Grails 3

27 Apr 2016

Tags: Grails, 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.

Published on 27 Apr 2016