Maven plugin for Vaadin Flow applications that handles frontend resource management, webpack bundling, and development workflow automation
The prepare-frontend goal sets up the development environment for Vaadin Flow applications by verifying tools, managing dependencies, and preparing configuration files.
<goal>prepare-frontend</goal>
<!-- Default phase: process-resources -->
<!-- Dependency resolution: compile-plus-runtime -->This goal performs essential development setup tasks:
node_modulespackage.json and webpack.config.js filesAll parameters inherit from the base plugin configuration. Key settings:
<configuration>
<!-- Tool verification -->
<nodeVersion>v18.17.0</nodeVersion>
<nodeAutoUpdate>true</nodeAutoUpdate>
<pnpmEnable>true</pnpmEnable>
<bunEnable>false</bunEnable>
<useGlobalPnpm>false</useGlobalPnpm>
<requireHomeNodeExec>false</requireHomeNodeExec>
<!-- Directory configuration -->
<frontendDirectory>${project.basedir}/src/main/frontend</frontendDirectory>
<npmFolder>${project.basedir}</npmFolder>
<generatedTsFolder>${frontendDirectory}/generated</generatedTsFolder>
<!-- Frontend scanning -->
<frontendScanner>
<enabled>true</enabled>
<includeOutputDirectory>true</includeOutputDirectory>
</frontendScanner>
</configuration><plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>24.9.0</version>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
</goals>
</execution>
</executions>
</plugin><plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>24.9.0</version>
<configuration>
<nodeVersion>v20.9.0</nodeVersion>
<nodeDownloadRoot>https://nodejs.org/dist/</nodeDownloadRoot>
<pnpmEnable>true</pnpmEnable>
<useGlobalPnpm>false</useGlobalPnpm>
</configuration>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
</goals>
</execution>
</executions>
</plugin><configuration>
<frontendDirectory>${project.basedir}/client-src</frontendDirectory>
<npmFolder>${project.basedir}/client-build</npmFolder>
<generatedTsFolder>${project.basedir}/client-src/generated</generatedTsFolder>
</configuration>Control which Maven artifacts are scanned for frontend resources:
<frontendScanner>
<enabled>true</enabled>
<includeOutputDirectory>true</includeOutputDirectory>
<includes>
<include>
<groupId>com.vaadin</groupId>
<artifactId>*</artifactId>
</include>
<include>
<groupId>org.vaadin.addons</groupId>
<artifactId>my-component</artifactId>
</include>
</includes>
<excludes>
<exclude>
<groupId>com.vaadin</groupId>
<artifactId>flow-server</artifactId>
</exclude>
</excludes>
</frontendScanner><!-- Exact match -->
<groupId>com.vaadin</groupId>
<artifactId>flow-client</artifactId>
<!-- Wildcard patterns -->
<groupId>com.vaadin*</groupId> <!-- Starts with -->
<artifactId>*-component</artifactId> <!-- Ends with -->
<groupId>*.vaadin.*</groupId> <!-- Contains -->
<artifactId>*</artifactId> <!-- All artifacts -->The goal creates or updates these files:
package.json - npm dependencies and scriptswebpack.config.js - Webpack configuration for developmentwebpack.generated.js - Generated webpack settingsThe goal includes IDE integration features:
# Run prepare-frontend goal
mvn flow:prepare-frontend
# Run with specific configuration
mvn flow:prepare-frontend -Dvaadin.pnpmEnable=true
# Debug execution
mvn flow:prepare-frontend -X
# Skip if already prepared (via Maven properties)
mvn flow:prepare-frontend -Dvaadin.prepare.skip=trueCommon issues and solutions:
Error: Node.js not found
Solution: Install Node.js or configure nodeDownloadRoot for corporate environmentsError: Cannot write to directory
Solution: Check file permissions or enable requireHomeNodeExecError: Cannot download Node.js
Solution: Configure corporate proxy or use nodeDownloadRoot for internal mirrorWarning: Multiple lock files found (package-lock.json and pnpm-lock.yaml)
Solution: Clean frontend and choose one package manager consistentlyInstall with Tessl CLI
npx tessl i tessl/maven-com-vaadin--vaadin-maven-plugin