vaadin-flowvaadin20

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


running ./gradlew vaadinBuildFrontend --stacktrace in a fairly simple Vaadin 20.0.3 project leads to

[...]
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

Config closure of vaadin does not configure any directory, so the plugin should use defaults:

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

Creating the build/frontend directory before running the task does not help. It gets deleted prior to the exception.


Solution

  • The https://github.com/vaadin/flow/issues/8033 ticket sounds similar. Can you try running Gradle with --dry-run to see whether the vaadinPrepareFrontend task has been run?

    Since this looks like a bug, the best thing to do is to open a bug report at https://github.com/vaadin/flow/issues .

    Also, please read this on how to use Vaadin Gradle plugin with multi-project builds: https://github.com/vaadin/vaadin-gradle-plugin/#multi-project-builds