Skip to content

Task with path 'generate' not found when using tasks.all and the com.vaadin plugin #8270

@sihutch

Description

@sihutch

Describe the bug

Executing ./gradlew clean build against our project, which includes tasks.all in the build.gradle results in the following exception:

Task with path 'generate' not found 

Expected-behavior

It should be possible to use tasks.all in the build.gradle without breaking the build

Reproduction

To reproduce the issue

clone: https://github.com/vaadin/base-starter-spring-gradle

Add the following to the bottom of the root build.gradle file.

afterEvaluate {
	tasks.all { task ->
	}
}

Execute ./gradlew clean build

You will see the the following exception

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':bootJar'.
> Task with path 'generate' not found in root project 'base-starter-spring-gradle'.

I think the problem is caused by this code in the hilla project

A more defensive pattern in the plugin would be something like:

if (project.tasks.findByPath("generate") != null) {
    task.mustRunAfter("generate")
}

or ensuing that the "generate" task is registerd.

System Info

Mac OS 14.8.1 (23J30)
Vaadin 24.9.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions