Hi Thiago.
I’ve found this stackoverflow post that might be related, did you try setting sourceCompatibility
and targetCompatibility
to 21 in your build.gradle
file?
Regards.
Hi Thiago.
I’ve found this stackoverflow post that might be related, did you try setting sourceCompatibility
and targetCompatibility
to 21 in your build.gradle
file?
Regards.
Hi @mmlopez . Thanks for the feedback! I saw that post too. I specified it in the root build.gradle and in a plugin inside buildSrc, which all modules include. That did not work. Perhaps I should specify in all individual build.gradle modules?
Yes, or maybe in just the modules that are failing. That can give us an idea of what could be going on.
I tried to add:
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
to all build.gradle files in the project, but it did not work.
One extra piece of information.
I am using sdkman to manage the SDKs.
default is Java 21
In use Java 21
In Intellij, project and gradle SDKs are pointing to version 21 as well
I was reviewing the so post that I shared with you earlier, and in there they are also mentioning about:
Thoughts?
At first I tried only deleting the .gradle folders in the project, but now I tried from the user home folder. Still no success, unfortunatelly.
I tried also to add:
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
But also no success.
It feels like vaadinBuildFrontend
is starting a parallel task with a different Java version. But I might be wrong.
It feels like one of those problems where you miss a small configuration.
I wonder if I can find the running version and location of the Java process which is failing there.
I will try to create a sample project with the problem to post it here.
I have prepared a sample project with the modular structure .
if you run bootRun it works fine. But if you run the production build command, then it fails.
I cannot upload to the forum so I uploaded it here:
Hi Thiago,
I can share the following repository that is a working setup of a multi-module gradle project, working with both java 17 and 21 when I build for production or run via command-line or IntelliJ:
Hope it helps. Don’t hesitate to share if it doesn’t work for you.
Thanks! I will have a look and compare what are the differences to see what I am missing.
Hi,
I have tested it by upgrading Hilla to the beta version and it works to compile it. But when I run the jar it tries to compile the frontend again. I am guessing it is because it is still in Beta. I will wait until the version 24.4 is released to try again. Thanks for the feedback and fix in the next version.
Just a question: To make sure something in your environment isn’t causing the issue, could you run/build the application from my repo on your local?
I did, and I got the same problem.
Steps were:
./gradlew -Philla.productionMode=true clean build
java -jar webapp/build/libs/webapp.jar
./gradlew -Philla.productionMode=true clean build
Due to integration of Hilla in Vaadin platform, the productionMode
should be set in vaadin
extention object instead:
./gradlew -Pvaadin.productionMode=true clean build
That makes sense.
I tried to compile it here with the correct parameter/flag and it fails on the same way.
It works on your example repository, it fails on the example I sent.
Would it make sense to exclude the failing class from the code generator?
Actually, I couldn’t access your project uploaded on that cloud service earlier. Is it possible to share it somewhere e.g. Github?
Sorry for the delay on this. I have published the code here:
Found the reason finally
The reason for the failure is actually the “asm” dependency version I have at “buildSrc”. The version 9.4 there is not compatible with Java 21. After upgrading to version 9.7, all works.
I find it strange that it uses that one over the 9.7 already in the project. I thought those dependencies would be there only the build of the plugins.