(Quick Reference) # 3.1 Upgrading from Grails 4 to Grails 5 Version: 6.0.0 ## 3.1 Upgrading from Grails 4 to Grails 5 ### Bump up Grails Version You will need to upgrade your Grails version defined in `gradle.properties` as: gradle.properties
    ...
    grailsVersion=5.2.0
    ...
### Apache Groovy 3.0.7 Grails 5.1.1 provide support for Groovy 3. We would recommend you to please check the Release notes for Groovy 3 to update your application in case you are using a specific feature which might not work in Groovy 3. Define groovyVersion in `gradle.properties` to force the application to use Groovy 3. Grails 5.1 app’s `gradle.properties` gradle.properties
    ...
    groovyVersion=3.0.7
    ...
### Bump up GORM Version If you were using GORM, you will need to update the version defined in `gradle.properties` as: gradle.properties
    ...
    gormVersion=7.2.0
    ...
### Bump up gradle version Grails 5.2.x uses gradle 7.2 gradle-wrapper.properties
    ...
    distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
    ...
Also you can run this command
    ./gradlew wrapper --gradle-version 7.2
### GORM for MonogDB Sync Driver The GORM for MongoDB is updated to support latest mongodb-driver-sync. If you are using GORM for MongoDB and doing something specific to MongoDB Driver or low level Mongo API then you might want to take a look at Upgrading to the 4.0 Driver ### Bump up Asset Pipeline plugin version The previous version of asset-pipeline is not supported with Grails 5.0 as it is compiled with a version of Groovy which is binary incompatible with Groovy 3. So, please update the plugin version to 3.2.4. ### Disabled StringCharArrayAccessor by default The previous version of Grails use the `StringCharArrayAccessor` which is enabled by default and provides optimized access to `java.lang.String` internals. In Grails 5.0 it is disabled by default but you can enable it by setting a system property with name `stringchararrayaccessor.disabled` and value `false`.
| Enabling StringCharArrayAccessor would show IllegalReflectiveAccess warnings as it uses reflection to do the optimizations.
### Changes in profile.yml and feature.yml files in Grails Profiles The format of how dependencies are defined in features and profiles has been changed. See the section on Application Profiles for more information. ### Deprecation of dot navigation of Grails configuration In order to reduce complexity, improve performance, and increase maintainability, accessing configuration through dot notation (config.a.b.c) has been deprecated. This functionality will be removed in a future release. Also, you would see a warning message if you are accessing configuration through the dot notation. The recommended way to access configuration is:
    grailsApplication.config.getProperty("hola", String.class)
### Deprecated Classes org.grails.config.NavigableMap org.grails.config.NavigableMapConfig org.grails.config.NavigableMapPropertySource ### Spring 5.3 Grails 5.0.0.RC1 is built on Spring 5.3.2 See the Upgrading to Spring 5.3 if you are using Spring specific features. ### Spring Boot 2.4 Grails 5.1.1 updates to Spring Boot 2.6. Please check Spring Boot 2.6 Release Notes for more information. ### Micronaut 3.2.0 Grails 5.1.1 is shipped with Micronaut 3.2.0. Please check the Upgrading to Micronaut 3.x if you are using a specific feature. ### Micronaut for Spring 4.0.1 Grails 5.1.1 is updated to Micronaut for Spring 4.0.1, please check out release notes for more information. ### Gradle 7.x #### Compile dependency configuration as well as others have been removed from Gradle 7.x. In previous version they were deprecated. Replace configurations: build.gradle
    ...
     compile -> implementation
     testCompile -> testImplementation
     runtime -> runtimeOnly
    ...
| More information in Gradle upgrade docs Gradle upgrade docs
#### Plugins in multi-project setup If you have grails plugins as part of multi-project builds you should also replace the `compile` with `implementation` configuration. Additionally if your main application relied on the dependencies declared by the plugin you need to apply further changes. To make the dependencies available again you have to declare them with `api` configuration. You also have to apply the `java-library` gradle plugin in your plugin project.
| More information gradle java-library-plugin
| Quick Reference (hide)