loading...

Grails 3 and Java 11+?

erichelgeson profile image Eric Helgeson ・4 min read

Sorting out Oracles new JDK release schedule and Grails 3.
Originally posted on https://grails3book.com/

Oracle announced they will be drastically speeding up their JDK releases – one every 6 months with no overlapping public support.

Java 9 was the first in this accelerated release cycle. While these JDK releases come quick, they end just as quickly. As you’re reading this JDK 9 & 10 are already End Of Life(EOL). JDK 11 is the next Long Term Support (LTS) release of the JDK.

With all this news, there has been some confusion about what will support what when and how people should be planning for in regards to Java releases and Grails. I’ll provide a few facts (and a few of my opinions) on what this means to you as a Grails developer.

Let’s start by answering a few concrete questions.

Will Grails 3 build on JDK 9+?

Grails 3.3.x is based on Spring-Boot 1.5. Spring-Boot 1.5 does not and will not support building in JDK 9+.

From Spring-boot's wiki

Spring Boot 2 is the first version to support Java 9 (Java 8 is also supported). If you are using 1.5 and wish to use Java 9 you should upgrade to 2.0 as we have no plans to support Java 9 on Spring Boot 1.5.x.

That’s definitive – you won’t be building Grails 3 apps in anything but JDK7/8 (and that’s ok, keep reading!)

Will Grails 3 run on JDK9+?

This is a much different question -

The answer is yes – Groovy runs (with a few warnings that can be disabled). You will also need to add jaxb explicitly to your CLI or in your dependencies – but it will run. If you use other 3rd party libraries though you will need to validate they will run on JDK9+ as well.

This is great news for user’s environments where you are not able to control your runtime and are forced to run on a newer JDK.

If I’m on JDK8 how long will it be supported?

Oracle has stopped shipping public JDK8 updates as of January 2019. Oracle plans no overlapping publicly supported binaries giving no breathing room for developers.

My recommendation is to switch to one of the many OpenJDK 8 (zulu, amzn, adpt, librca, etc!) distributions which will be supported until at least October 2020+ or pay Oracle for support. If you run on any PaaS such as AWS Elastic Beanstalk you’ve already been running on OpenJDK. sdkman makes it easy to setup OpenJDK on your workstation as well.)

When can I use Java 11 with Grails?

Spring-Boot 2.1 was released (October 30th, 2018.) The Grails team is already working on Grails 4 based on it. Quarter 2 of this year (2019) is the targeted release.

Now for a few of my opinions.

Grails builds on top of many projects such as Spring-Boot, Hibernate, Gradle, etc. All of these projects need to support the latest JDK before Grails can. This IMO is a good thing – it means many compatibility issues and bug fixes can be worked out before I start using it.

What should we do for now?

  • Spring-Boot 1.5 is maintained until August 1st, 2019 developed and Grails 3 will continue to use it.

  • Upgrade your apps to Grails 3.3.10 now to make the upgrade path to 4.0.0 simpler. See my Grails 4 Upgrade notes

  • If you are using Oracles JDK 8 switch to OpenJDK 8 for security updates or pay Oracle for extended support.

  • Continue to build on JDK 8 and you should be fine running on JDK 11 if you need to.

  • Stick to LTS JDK releases such as 8 and 11.

  • Don’t adopt Short Term Support (STS) or end of life JDK’s such as 9/10/13/etc

Conclusion

I use Grails so I don’t have to worry about these compatibility issues – I get a nice package of things that are recent and work together. I’ll be happy to let this JDK madness shake out before I get in the middle of it – I have features to ship to users rather than worry about JDK’s that are only supported for 6 months.

Discussion

pic
Editor guide