Does Grails 3.x support Java 11

3.4k Views Asked by At

I know Java 11 has not been officially released yet, but has anyone tested Grails 3.x with an early access release of Java 11? Or does anyone know when or if Grails 3.x will support Java 11?

3

There are 3 best solutions below

2
On

I know Java 11 has not been officially released yet, but has anyone tested Grails 3.x with an early access release of Java 11?

I tried using Grails 3.3.8 and the early access release of JDK 11 and it didn't work, but I wondered if that might be something to do with the JDK.

Then I tried again using Oracle's official release of JDK 11 which came out a couple of days ago. I rebuilt an existing Grails project in NetBeans 9.0 using JDK 11 / Grails 3.3.8, and got the following error:

Command [clean] error: Could not determine java version from '11'. (Use --stacktrace to see the full trace)

I get similar errors when using JDK 9 and 10, but the project builds and runs fine using JDK 8.

See this SO answer for a similar problem when using Grails with JDK 10: Could not determine java version from '10.0.2' while starting Grails 3.3.8 application:

Grails 3.3.8 does not support Java 10. You will have to use Java 7 or Java 8 if you want to use Grails 3.3.8.

Or does anyone know when or if Grails 3.x will support Java 11?

Grails 3.x won't ever support JDK 11 according to a Grails developer. See the comments for the SO answer I linked to above:

You have to wait for Grails 4 to use a JDK > 8.

I don't know anything about a proposed release date for Grails 4.

0
On

Well I know that the support for Java 9+ in Groovy is getting worked on and I think 2.5.2 had some fixes. Technically Groovy will work on newer versions of java, but you'll get a bunch of warnings. All of this is supposed to be worked out for Groovy 3.0, probably coming around the end of the year, based on what I hear at GR8Con.US.

All that being said, Grails 3.3 is on Groovy 2.4.x, with spring boot 1.2, which I don't think either support newer versions of Java. Grails 4 is supposed to be coming out by the end of the year, with Groovy 2.5, and a newer version of spring boot. Once Groovy 3 comes out it shouldn't be too long before Grails upgrades to it.

Also check out the Groovy Podcast, there was a metion on the support from Groovy: https://youtu.be/XQLblr2OGJ8

0
On

Java 11 is supported in Grails 4. However, note Grails 4 still builds on Groovy 2.5.x which doesn't run all that smooth on Java 9-11 compared to Groovy 3. So warnings and stuff like that is to be expected.

//EDIT 22/01/2022: Grails 5 is build is built on Groovy 3.0.x and therefore works smoothly with Java 11.