Upgrade to 24.7.1 results in failure in task 'vaadinBuildFrontend'

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.

Any ideas what could cause this problem?

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.

Looks like a classloader issue

Does the app use Spring-Clould by any chance?

No, Spring Cloud is not in the classpath.

Unfortunately, the project is not public. I will try to create a public repo where the problem is reproducible.

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:

Thank you, @Soroosh_Taefi. The baseline for my project was GitHub - vaadin/skeleton-starter-hilla-react-gradle. Because I don’t use Kotlin in my project, I think I will try to create a reproducible path using GitHub - vaadin/skeleton-starter-hilla-react-gradle.

Is this the plugin, that is responsible for registering the available tasks in a Hilla Gradle project: hilla/packages/java/gradle-plugin at main · vaadin/hilla · GitHub ?

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.

OK, thank you :slight_smile:

Looking at the code, it might be this place, that causes my issue:
image

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:

and with 24.7.1. I only have this 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.

I guess this change was introduced with: Add check for Spring Boot plugin · vaadin/hilla@9163fa8 · GitHub.

2 Likes

Thanks for the checking this out. This is a bug, so I created the following issue for this:
Gradle Plugin: applying before SpringBoot plugin breaks the configure/generate tasks #3390
The following PR should make it order independent:
fix: register Hilla tasks upon applying SpringBoot plugin #3391

1 Like

Thank you, @Soroosh_Taefi :heart_hands:

1 Like