Vaadin 20 Gradle 插件:vaadinBuildFrontend 失败 "Path provided by parameter 'outputDirectory' (%s) is not a directory"

Vaadin 20 Gradle Plugin: vaadinBuildFrontend fails with "Path provided by parameter 'outputDirectory' (%s) is not a directory"

运行 ./gradlew vaadinBuildFrontend --stacktrace 在一个相当简单的 Vaadin 20.0.3 项目中导致

[...]
Caused by: com.vaadin.flow.server.ExecutionFailedException: Error occured during goal execution: Could not write exported web component module because of exception: Path provided by parameter 'outputDirectory' (PROJECT/SUBPROJECT/build/frontend) is not a directoryPlease 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:307)
        at com.vaadin.gradle.VaadinBuildFrontendTask.vaadinBuildFrontend(VaadinBuildFrontendTask.kt:73)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
        ... 119 more
Caused by: java.lang.RuntimeException: Could not write exported web component module because of exception: Path provided by parameter 'outputDirectory' (PROJECT/SUBPROJECTe/build/frontend) is not a directory
        at com.vaadin.flow.server.webcomponent.WebComponentModulesWriter$DirectoryWriter.generateWebComponentsToDirectory(WebComponentModulesWriter.java:264)
        at com.vaadin.flow.server.frontend.FrontendWebComponentGenerator.generateWebComponents(FrontendWebComponentGenerator.java:95)
        at com.vaadin.flow.server.frontend.NodeTasks.<init>(NodeTasks.java:597)
        at com.vaadin.flow.server.frontend.NodeTasks.<init>(NodeTasks.java:54)
        at com.vaadin.flow.server.frontend.NodeTasks$Builder.build(NodeTasks.java:215)
        at com.vaadin.flow.plugin.base.BuildFrontendUtil.runNodeUpdater(BuildFrontendUtil.java:300)
        ... 121 more
Caused by: java.lang.IllegalArgumentException: Path provided by parameter 'outputDirectory' (PROJECT/SUBPROJECT/build/frontend) is not a directory
        at com.vaadin.flow.server.webcomponent.WebComponentModulesWriter.writeWebComponentsToDirectory(WebComponentModulesWriter.java:91)
        at com.vaadin.flow.server.webcomponent.WebComponentModulesWriter$DirectoryWriter.generateWebComponentsToDirectory(WebComponentModulesWriter.java:250)
        ... 126 more

vaadin的Config闭包不配置任何目录,所以插件应该使用默认值:

vaadin {
    optimizeBundle = false
    productionMode = false
    pnpmEnable = true
}

在 运行 任务之前创建 build/frontend 目录没有帮助。它在异常之前被删除。

https://github.com/vaadin/flow/issues/8033 票听起来很相似。可以试试运行ning Gradle with --dry-run 看看vaadinPrepareFrontend任务是否已经运行?

由于这看起来像一个错误,最好的办法是在 https://github.com/vaadin/flow/issues 打开一个错误报告。

另外,请阅读这篇关于如何使用 Vaadin Gradle 插件进行多项目构建的文章:https://github.com/vaadin/vaadin-gradle-plugin/#multi-project-builds