Grails 4 Upgrade Notes

Practical Grails 4 is in development! Signup here to be the first to know when it's avalible.

February 19, 2019

Status

Ported non-trivial app - builds and runs on Grails 4.0.0.RC1 OpenJDK 11.0.2. Startup is about 15 seconds. (2x faster than Grails 3.3.9)

IDE Support all works in Grails 4 (same as 3.3.9)

Plugins

Working

  • Spring-Security-Core 4.0.0.M2

  • Spring-session-redis (boot starter)

    • Updated dependencies

compile "org.springframework.boot:spring-boot-starter-data-redis"
compile "org.springframework.session:spring-session-data-redis"
  • Spring-Websocket

compile "org.grails.plugins:grails-spring-websocket:2.5.0.RC1"
  • Grails-Quartz

buildscript {
    dependencies {
        classpath 'org.grails.plugins:quartz:2.0.13' // Needed to compile *Job classes
    }
}

dependencies {
    compile 'org.grails.plugins:quartz:2.0.13'
    compile 'org.quartz-scheduler:quartz:2.2.1' // Is not pulled in by default?
}
  • External Config

    • Works - use RC1

    compile 'org.grails.plugins:external-config:2.0.0.RC1'

Mostly working

Resolved

  • Asset Pipeline Handlebars issue:

    • Needed to update to change //= require handlebars/handlebars.js to //= require handlebars-runtime

2019-01-13 16:59:42.280  WARN --- [nio-8080-exec-1] asset.pipeline.DirectiveProcessor        : Unable to Locate Asset: /handlebars/handlebars.js
Warning: Nashorn engine is planned to be removed from a future JDK release
  • Gson Views

    • Resolved.

    • Unable to render json with simple objects (just get null response)

    • Domain classes dont render: ` Model variable [someDomain] of with value [Description] type [com.x.SomeDomain] is not of the correct type [com.x.SomeDomain]. Stacktrace follows: `

    • Opened Issue https://github.com/grails/grails-views/issues/202

Notes

  • Install

sdk install java 11.0.2-open
sdk install grails 4.0.0.RC1
  • No more hot reload (spring-loaded)

    • Fast reload takes about 5-6 seconds (hopefully can improve)

    • Running ./gradlew test caused a reload?

    • Side benefit - you can reload domain class changes

  • Groovy 2.5.6

    • Doesn’t include the Date Utils helpers by default - need to add them in.

    • compile 'org.codehaus.groovy:groovy-dateutil'

    • (Should just update to java.time.*)

    • JDK 11 Warnings (expected)

    • Disable by setting env var GROOVY_TURN_OFF_JAVA_WARNINGS=true

  • Dependencies (Gradle 5.1)

    • Odd issue where dependencies like com.jameskleeh:excel-builder - dont pull in their dependencies (eg: Apache POI)

  • Hibernate Deprecated warnings (expected)

    • Hibernate’s legacy org.hibernate.Criteria API is deprecated; use the JPA javax.persistence.criteria.CriteriaQuery instead

    • Hide em in logback.groovy - logger('org.hibernate.orm.deprecation', ERROR, ['STDOUT'], false)

    • HHH020100: The Ehcache second-level cache provider for Hibernate is deprecated. See https://hibernate.atlassian.net/browse/HHH-12441 for details.