Maven plugin for Vaadin Flow applications that handles frontend resource management, webpack bundling, and development workflow automation
The clean-frontend and dance goals reset the frontend development environment by removing generated files and dependencies.
<goal>clean-frontend</goal>
<!-- Alternative Easter egg goal -->
<goal>dance</goal>
<!-- Default phase: pre-clean -->Both goals perform identical cleanup operations. The dance goal is a playful alias for clean-frontend.
These goals clean the frontend environment by removing:
node_modules directorypnpm-lock.yaml filepackage-lock.json filepackage.json<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>24.9.0</version>
<executions>
<execution>
<goals>
<goal>clean-frontend</goal>
</goals>
</execution>
</executions>
</plugin><plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>24.9.0</version>
<executions>
<execution>
<phase>pre-clean</phase>
<goals>
<goal>clean-frontend</goal>
</goals>
</execution>
</executions>
</plugin><execution>
<goals>
<goal>dance</goal> <!-- Same as clean-frontend but more fun! -->
</goals>
</execution>project-root/
├── node_modules/ (entire directory)
├── pnpm-lock.yaml (if using pnpm)
├── package-lock.json (if using npm)
├── yarn.lock (if using yarn)
└── src/main/frontend/
└── generated/ (generated files)The goal removes Vaadin-specific dependencies from package.json:
@NpmPackage annotationsOriginal user-defined dependencies remain intact.
# Standard cleanup
mvn flow:clean-frontend
# Easter egg cleanup (same functionality)
mvn flow:dance
# Full clean with Maven lifecycle
mvn clean # (if plugin configured in pre-clean phase)
# Force cleanup even with errors
mvn flow:clean-frontend -Dvaadin.ignoreErrors=trueUse cleanup when experiencing:
node_modules# Reset after major dependency changes
mvn flow:clean-frontend
mvn flow:prepare-frontend
# Clean CI/CD pipeline
mvn flow:clean-frontend
mvn flow:build-frontend -Dvaadin.ciBuild=true
# Switch package managers
mvn flow:clean-frontend
# Configure plugin for different package manager (pnpm/npm)
mvn flow:prepare-frontend<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>24.9.0</version>
<executions>
<execution>
<id>clean-frontend</id>
<phase>pre-clean</phase>
<goals>
<goal>clean-frontend</goal>
</goals>
</execution>
<execution>
<id>prepare-frontend</id>
<phase>process-resources</phase>
<goals>
<goal>prepare-frontend</goal>
</goals>
</execution>
<execution>
<id>build-frontend</id>
<phase>process-classes</phase>
<goals>
<goal>build-frontend</goal>
</goals>
</execution>
</executions>
</plugin>Use Maven profiles for conditional cleanup:
<profiles>
<profile>
<id>clean-frontend</id>
<activation>
<property>
<name>clean.frontend</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>24.9.0</version>
<executions>
<execution>
<goals>
<goal>clean-frontend</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>Activate with:
mvn compile -Pclean-frontend
# or
mvn compile -Dclean.frontend=trueError: Cannot delete files in node_modules
Solution: Ensure proper file permissions, run as administrator if needed on WindowsError: Cannot delete locked files
Solution: Stop development server, close IDE, ensure no processes are using node_modulesWarning: Some files could not be removed
Solution: Manually remove problematic files/directories, check for file system issuesIn corporate environments with restricted file systems:
<configuration>
<!-- Clean to temporary directory first -->
<tempCleanupDirectory>${java.io.tmpdir}/vaadin-cleanup</tempCleanupDirectory>
</configuration>For Maven multi-module projects:
# Clean all modules
mvn flow:clean-frontend -pl .,module1,module2
# Clean only specific modules
mvn flow:clean-frontend -pl frontend-module#!/bin/bash
# CI cleanup script
mvn flow:clean-frontend || true # Continue on errors
rm -rf node_modules pnpm-lock.yaml package-lock.json # Force cleanup
mvn flow:prepare-frontend
mvn flow:build-frontend -Dvaadin.ciBuild=trueThe dance goal is identical to clean-frontend but adds a playful element to the build process. It was added as an Easter egg for developers who prefer more colorful build commands:
mvn flow:dance # ✨ Same as clean-frontend but with more style! ✨This is a hidden feature mentioned in the source code comments as "This is the hidden vaadin:dance to clean up the frontend files."
Install with Tessl CLI
npx tessl i tessl/maven-com-vaadin--vaadin-maven-plugin