Friday, February 14, 2014

Grails: Solving "Failed to resolve dependencies" exception

When upgrading grails to version 2.3.0, I got the following error.
Failed to resolve dependencies ... org.grails.plugins:tomcat:2.3.0 ...
hibernate:2.3.0 ...

This is because as of Grails 2.3.0, the tomcat and hibernate plugins (as well as the scaffolding and webflow plugins) have been split out as completely independent plugins and are no longer versioned with Grails. You need to use explicit versions now instead of using $grailsVersion.
Hence, I replaced the following things in my BuildConfig.groovy file

 OLD:        runtime ":hibernate:$grailsVersion" // For versions prior to Grails 2.3.0 
 NEW: runtime ':hibernate:3.6.10.1'

 OLD:        build ":tomcat:$grailsVersion" // For versions prior to Grails 2.3.0      
 NEW: build ':tomcat:7.0.42'

And I added the following line to be able to run the create- and generate- scripts in Grails 2.3.0
//To run the create- and generate- scripts in Grails 2.3.0

compile ':scaffolding:2.0.0'