Hi everyone,
I just wanted to upgrade an existing Hilla application from 24.6.6 to 24.7.1. I changed the version in my gradle.properties and executed :vaadinClean followed by :vaadinBuildFrontend. The second task failed with the following output:
Execution failed for task ':vaadinBuildFrontend'.
> com.vaadin.flow.server.ExecutionFailedException: Error occured during goal execution: [JVM Parser] endpoint annotations are not provided.
Caused by: com.vaadin.flow.server.ExecutionFailedException: Error occured during goal execution: [JVM Parser] endpoint annotations are not provided.Please run Maven with the -e switch (or Gradle with the --stacktrace switch), to learn the full stack trace.
at com.vaadin.flow.plugin.base.BuildFrontendUtil.runNodeUpdater(BuildFrontendUtil.java:370)
at com.vaadin.gradle.VaadinBuildFrontendTask.vaadinBuildFrontend(VaadinBuildFrontendTask.kt:80)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
... 119 more
Caused by: java.lang.IllegalArgumentException: [JVM Parser] endpoint annotations are not provided.
at com.vaadin.hilla.parser.core.Parser.execute(Parser.java:274)
at com.vaadin.hilla.engine.ParserProcessor.createOpenAPI(ParserProcessor.java:57)
at com.vaadin.hilla.engine.ParserProcessor.process(ParserProcessor.java:67)
at com.vaadin.hilla.internal.TaskGenerateOpenAPIImpl.execute(TaskGenerateOpenAPIImpl.java:66)
at com.vaadin.flow.server.frontend.NodeTasks.execute(NodeTasks.java:345)
at com.vaadin.flow.plugin.base.BuildFrontendUtil.runNodeUpdater(BuildFrontendUtil.java:364)
... 122 more
The application has two services. Both are annotated with @BrowserCallable.
During compilation, I saw the warnings about the deprecated Nonnull and Nullable annotations. I changed the annotations to the suggested NonNull and Nullable from JSpecify, but this did not solve the error above.
Hi @rbrki07!
That error happens when the Hilla Parser is executed (as part of the tasks for frontend build), but no endpoint annotations such as @BrowserCallable and @Endpoint are provided while the context being created for its execution by the Gradle plugin. The parser is implemented agnostic to the annotations is should use, so even the annotations that it can use to locate the endpoints can be replaced/configured. IMO, nothing from a user code should result in this error. Anyway, thanks for reporting this.
If the project you tried this on is a public one and could be shared, it will help us reproducing the issue faster.
Generally whenever I try to upgrade, I have to delete package-lock.json, delete vite.generated.ts
And as a good measure i delete frontend/generated folder as well.
Then if i change the vaadin version in pom.xml it works.
I discovered an interesting difference in the related project. Running with Vaadin 24.6.6 the Gradle configuration contains the tasks hillaConfigure and hillaGenerate and when I execute the Gradle task vaadinBuildFrontend I see the following files being created:
build/classes/hilla-openapi.json
build/hilla-engine-configuration.json
After upgrading the project to Vaadin 24.7.1 the Gradle tasks hillaConfigure and hillaGenerate are gone and when I execute the Gradle task vaadinBuildFrontend I don’t see the files mentioned above in the build folder.
I created a simple Kotlin-Gradle demo project to switch between the 24.6.6 and 24.7.1, and it is working, and thought it might worth sharing, so that you can try breaking it with more complex stuff scenarios, dependencies, etc. for reproducing the issue:
Yes, that’s the plugin. Although, in practice, this plugin is repackaged as vaadin-gradle-plugin when Vaadin platform is released, but it doesn’t/shouldn’t change any functionality.
Looking at the code, it might be this place, that causes my issue:
For some reason, the plugin won’t register the tasks hillaConfigure and hillaGenerate in my project after upgrading to 24.7.1. And before someone asks: Yes, I do have the Spring Boot plugin in my project ;)
With 24.6.6 I have the following Vaadin Gradle tasks:
OK, here is what I found out: In Vaadin 24.7.1 the order in which I register the Gradle plugins are important: Vaadin’s Gradle Plugin needs to be registered after Spring Boot’s Gradle Plugin.
This is fine for 24.6.6, but not for 24.7.1:
plugins {
// ...
id "com.vaadin"
id "org.springframework.boot"
}
This is how it should look like for Vaadin 24.7.1:
plugins {
// ...
id "org.springframework.boot"
id "com.vaadin"
}
Otherwise, the Gradle Tasks hillaConfigure and hillaGenerate won’t be registered and without these tasks the build will fail, because hilla-engine-configuration.json and hilla-openapi.json won’t be there.