问题描述
在相当简单的 Vaadin 20.0.3 项目中运行 ./gradlew vaadinBuildFrontend --stacktrace
导致
[...]
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 的配置关闭不配置任何目录,所以插件应该使用默认值:
vaadin {
optimizeBundle = false
productionMode = false
pnpmEnable = true
}
在运行任务之前创建 build/frontend
目录没有帮助。它在异常之前被删除。
解决方法
https://github.com/vaadin/flow/issues/8033 票听起来很相似。您可以尝试使用 --dry-run
运行 Gradle 以查看 vaadinPrepareFrontend 任务是否已运行吗?
由于这看起来像是一个错误,最好的做法是在 https://github.com/vaadin/flow/issues 打开错误报告。
另外,请阅读有关如何在多项目构建中使用 Vaadin Gradle 插件的信息:https://github.com/vaadin/vaadin-gradle-plugin/#multi-project-builds