Grails 3 Upgrading from 3.2.x to 3.3.0

Upgrading and/or migration is one of the most frequent jobs nowadays in IT world. As big step upgrading of grails from 3.2.x to 3.3.0 can be a tricky task. Updates and upgrades are going out on monthly or even on weekly basis. If you want to upgrade your Grails(open source web application framework) project there are several steps to follow:

In this post:

  • Why to upgrade Grails Project
  • The steps of upgrading 3.2.x to 3.3.0
    • changes in build.gradle
    • new dependencies
    • new spring security pluggin
    • change hibernate version
    • update -
  • Grails configuration - Windows
    • Set grails environmental variables
    • Check grails configuration
  • Grails configuration - Linux or MacOS
  • Groovy/Grails proxy configuration

Why to upgrade Grails Project

The biggest incentive for me to upgrade to 3.3.0 was the size of the generated war file. I was able to reduce the size with 30 - 50 % (depending on the app). Many dependencies are change or removed.

  • For new generated empty applications:
  • 3.2.x ~ 80 MB war file
  • 3.3.0 ~ 40 MB war file

The steps of upgrading 3.2.x to 3.3.0

  • read the changes logs
  • 3 Upgrading from Grails 3.2.x
  • upgrade Grails version(check section - Grails configuration)
  • generate empty app with 3.3.0 with profile web:
  • I use it as reference what's new - files, configuration, dependencies,
grails create-app bookstore --profile web --features hibernate,asset-pipeline
  • change files:
  1. build.gradle - dependencies align with the new version. In my case changes were:

  2. replaced my old section with the newly generated section in the new app

         classpath "org.grails:grails-gradle-plugin:$grailsVersion"
          classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.14.2"
         classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}"
  3. new dependencies

    compile "org.grails:grails-web-boot"
    compile "org.grails:grails-logging"
    compile "org.grails:grails-plugin-rest"
    compile "org.grails:grails-plugin-databinding"
    compile "org.grails:grails-plugin-i18n"
    compile "org.grails:grails-plugin-services"
    compile "org.grails:grails-plugin-url-mappings"
    compile "org.grails:grails-plugin-interceptors"
    compile "org.grails.plugins:cache"
    compile "org.grails.plugins:events"
  • change spring security pluggin:

  • compile 'org.grails.plugins:spring-security-core:3.0.3'

  • new one is - compile 'org.grails.plugins:spring-security-core:3.2.0.M1'

  • change hibernate version:

  • compile "org.hibernate:hibernate-core:5.1.1.Final"

  • new one is - compile "org.hibernate:hibernate-core:5.1.5.Final"

  • remove:

  • compile "org.hibernate:hibernate-ehcache:5.1.1.Final"

  • - change gradle and grails properties

  • - in folder ..\IdeaProjects\fanta\gradle\wrapper\ - change gradle version

  • this change was needed due to an error at boot time of the app

  • maybe is not needed.

  • Find all imports:

  • grails.transaction.Transactional

  • and replace them by: grails.gorm.transactions.Transactional

  • enum types stored value change - my enumeration were stored as numbers. After the upgrade store values were changed to strings. In order to change back this behavior you need to go to your enum declaration (your domain file where you use this domain and add this line of code:

    static mapping = {
        field1 enumType : "ordinal"
        field2 enumType : "ordinal"
        field3 enumType : "ordinal"
  • gradle clean or import the gradle change via IDE

Grails configuration - Windows

  • download the .zip files - Grails Download
  • extract it the libraries path(depending on your needs): C:\Users\user\Libraries\gradle-3.5-all\gradle-3.5\bin
  • update environmental variables with the new one (see section set environmental variables)
  • change proxy settings(if needed) - (see section proxies)

Grails, Gradle and Groovy proxies

Grails proxy configuration

  • in bin folder(of grails installation or unarchived folder)
  • copy file: grails.bat -> grailsNoProxy.bat
  • change file: grails.bat - add this line:
set -Dhttp.proxyPort=8080 -Dhttps.proxyPort=8080

Gradle proxy

  • for gradle proxy go to:
  • C:\Users\user.gradle
  • create file
  • and put:

Groovy proxy configuration

  • in bin folder(of groovy installation or where the zip was folder extracted)
  • copy file: groovy.bat -> groovyNoProxy.bat
  • change file: groovy.bat - add this line:
set -Dhttp.proxyPort=8080 -Dhttps.proxyPort=8080

Set grails environmental variables

Set grails variables for windows

Notice that you need to change the versions with your versions of the libraries. There 4 required variables: GRADLE_HOME, GRAILS_HOME, GROOVY_HOME and JAVA_HOME.

    JAVA_HOME=C:\Program Files\Java8\jdk1.8.0_91

Set Path variable

   setx path "%PATH%;%JAVA_HOME%\bin;%GRAILS_HOME%\bin;%GROOVY_HOME%\bin;%GRADLE_HOME%\bin;

Check grails configuration

  1. Open terminal or command shell
  2. Type
  grails -v
  gradle -v
  gradle -v
  java -v
  1. If any of this return command not found this means that your configuration is wrong.
  2. sample output of grails -v
| Grails Version: 3.3.0
| Groovy Version: 2.4.11
| JVM Version: 1.8.0_111

Grails configuration - Linux or MacOS

The main page of the SDK is SDK man Installation .
Just lunch those commands in terminal.
In case that you use Intellij IDE and since it uses system grails installations it's not needed any other actions.


$ sdk install gradle


$ sdk install grails


$ sdk install groovy
Share Tweet Send
You've successfully subscribed to SoftHints - Python, Data Science and Linux Tutorials
Great! Next, complete checkout for full access to SoftHints - Python, Data Science and Linux Tutorials
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.