The Grails team released Grails 3.0, a complete rewrite of the popular MVC framework now based on Spring Boot. Grails 3.0 contains a number of new features including Groovy 2.4 and Android support, Spring 4.1, and Gradle replacing the old Gant-build system.
No direct upgrade path has been provided. The upgrade guide suggests migrating by creating a new Grails 3.0 application of the same name and copying the source files into the correct locations in the new application. The project structure is slightly modified, so developers are encouraged to review that section while upgrading.
Michael Scharhag, a Java Web Developer, has clearly detailed the new project structure in What’s New in Grails 3.
To learn more about this release, InfoQ interviewed Jeff Brown, Principal Software Engineer and Senior member of the Grails Core Team.
InfoQ: First of all, congratulations on the Grails 3.0 release! It must have been quite a challenge to rewrite a Spring Boot version of Grails. What components were particularly difficult to migrate to the new architecture?
Brown: There was a lot of work to do but I don’t think there were any pieces that were particularly difficult. Both Grails and Boot are really well architected and that made the process easier than it might otherwise have been. Some of the work involved removing things that Grails used to manage, that Boot could now manage for us. One important piece that was a must-have for Grails that Boot doesn’t provide is a plugin system, which is a giant must-have for Grails. The extensibility of the framework is a really important part of the whole story and giving that up wasn’t ever an option. We have to have the plugin system so we made that all work and all is well there. All in all the migration to Boot went pretty smoothly and the framework is in a really great position now that we have done that work.
InfoQ: You've moved from Gant to Gradle for the build system. How will this benefit Gradle users?
Brown: Gradle is a great build tool and we have wanted to make this change for a while now. Grails 3 was the perfect time to do that. Prior to Grails 3 we have always had our own build system in the framework and that build system was built on Gant. The build system worked quite well but had its limitations and was one piece of the puzzle that it just doesn’t make sense for us to maintain. Solving that problem really well is difficult to do and shouldn’t really be the responsibility of the framework. The Gradle team has done a really spectacular job and it was just kind of a no-brainer to take advantage of that great work, so we did. You have been able to use Gradle to build Grails applications for quite a while now but as of Grails 3 we have first class integration with Gradle. When you create a Grails 3 app or plugin the Gradle build config is ready to go, including the generated Gradle wrapper files so you don’t even have to have Gradle installed. It is great to finally have that kind of support right out of the box.
InfoQ: Is it possible to run Grails 2.x applications with Grails 3.0? If not, how difficult is it for developers to migrate to 3.0?
Brown: It is not really possible to run Grails 2 applications with Grails 3. Grails 2 applications will need to be updated to Grails 3. For the great majority of applications that migration won’t be too bad. What it takes to upgrade a Grails 2 app to Grails 3 really depends on what kinds of things the application is doing. For example, if the app contains a lot of integration with the build system, that upgrade will require a bit more attention since the new Gradle based build system is complete overhaul of the old build system. The new system is much more powerful and flexible, but not compatible with the old build system. Fortunately, most apps don’t interact directly with the build system, but that is an example of something that would have to be dealt with during an upgrade. The way that applications express dependencies on plugins and other libraries is different in Grails 3 so that needs to be addressed. Mostly that is copying code that used to be in BuildConfig.groovy into build.gradle and changing some of the details of how those dependencies are expressed. That is all a one-time cost that is very easy to do. Most of the code under grails-app/ will be good to go and won’t require attention during the upgrade. Most of the code under src/groovy/ can just be moved into the new src/main/groovy/ and again, for the most part will be good to go. There are details like the @Validateable annotation has been replaced with a Validateable trait. The bottom line is that the upgrade steps will be different depending on what the app is doing but it really won’t be bad. That little bit of work is the price for getting to the next generation framework.
InfoQ: Last week, it was announced that "Grails has a New Home at OCI". However, from looking at the press release, it looks like they simply hired you and Graeme Rocher. Is there more to this announcement?
Brown: Yes. OCI has hired Graeme and myself, and that alone is great news because it reassures users and potential users that the framework is in good hands and will continue to move forward.
In addition to that, OCI is now the official sponsor and has taken over funding for the Grails project. The Grails core team retains full autonomy as to how the project will be developed and advanced. Our decision to go with OCI was largely based on OCI’s long-standing commitment to Open Source and its appreciation of the Grails technology.
In the immediate short term, we are actively supporting the newly-released Grails 3.0 and will soon be working to finalize the scope and timeline for Grails 3.1.
Moving forward, OCI is committed to increasing the exposure of Grails, and we are actively engaged with a number of existing OCI clients who are heavily invested in the framework. We are working with OCI internal product development teams to integrate Grails technology with other open source infrastructure technologies that OCI supports. We are very optimistic about where we are headed with Grails. Great things are coming.
InfoQ: Groovy recently moved to the Apache Software Foundation? Do you have similar plans for Grails?
Brown: OCI is the official sponsor for Grails. We are managing Grails in much the same way that it has always been managed. We welcome contributions from the community and often work closely with developers from the community to help them contribute either directly to the framework or in the form of Grails plugins. The move to OCI hasn’t changed the technical leadership of the framework or any of the logistics around how we publish releases, etc.
InfoQ: Is there anything you'd like to say to Grails users or companies looking to contribute to the project?
Brown: I would say to companies or individuals who want to contribute that we welcome that. For small things, we encourage folks to engage us on the Grails Developer Google Group at https://groups.google.com/forum/#!forum/grails-dev-discuss. For larger scale endeavours, we are happy to speak directly with developers and organizations. When it makes sense to establish some kind of partnership to co-fund the development of large scale efforts, we do that too. Often we are approached by developers who love the framework and want to give back but are intimidated by making code changes to the framework itself. One great way for some of those people to contribute is by contributing updates to The Grails User Guide which is open source just like the framework itself. Working with individuals as well as large corporations who want to contribute is important to us. We encourage anyone interested in contributing to contact us, and we will help move that forward.
InfoQ: Best of luck to you Jeff, we really appreciate your time.
Brown: No problem at all. We are really happy that folks are enthusiastic about getting from Grails 2 to Grails 3. We are happy to do whatever we can to help.