Unable to build production jar with Java 21 and Vaadin 24 using Gradle

Hello, I am unable to build a production jar for my Vaadin project with Java 21; it works with 17.

vaadinBuildFrontend task fails with “Visiting class DashboardView failed with Unsupported class file major version 65. This might be a broken class in the project.” error which I think comes from asm. I’ve tried changing target compatibility back to 17 but that does not help.

I am using version 24.2.4, any ideas how I could fix this isssue? Thanks :)

I’ve had a similar issue. Make sure that the version of java that you are running gradle with is at least the target version. Setting the java version in your build.gradle is insufficient as vaadinBuildFrontend is run directly by gradle so must be compatible.

Hey :wave: thanks for responding! I think I did setup everything correctly, project SDK is 21, Gradle JVM is set to 21 as well and I am running on the latest gradle rc with 21 support, but unfortunatelly I am still getting the same error.

Can you share your project or a reproducible example?

nevermind, I managed to fix the issue, it was due to outdated kotlin version