test-watch-maven-plugin
June 6, 2026 · View on GitHub
Vitest-inspired watch mode for Maven tests. Save a file, see your test results instantly — no IDE required.

Why?
You're working on a Java project. You change a class. Now you need to know if the tests still pass.
Your options:
mvn test— slow, runs everything, 30+ seconds of waiting- Infinitest — great, but IDE-specific (Eclipse/IntelliJ only), and doesn't work for everyone's setup
- Switch to Gradle just for
--continuous? Overkill.
test-watch-maven-plugin gives you the same instant feedback loop you get with Vitest, Jest, or cargo watch — but for Maven. Save a .java file, and only the affected tests run. In parallel. With readable output.
Features
- 👀 File watching — monitors your source tree for changes
- 🎯 Smart test selection — only re-runs tests affected by changed files (configurable patterns)
- ⚡ Parallel execution — runs tests concurrently for faster feedback
- 📊 Readable summaries — clean pass/fail output, not Maven's wall of text
- 🔌 Maven-native — no extra daemon, no IDE plugin, just
mvn - 🧩 Configurable — include/exclude patterns, test matching, parallel toggle, smart selection toggle
Requirements
- Java JDK 11+
- Maven 3.6+
Quick Start
Add the plugin to your pom.xml:
<build>
<plugins>
<plugin>
<groupId>io.github.albilu</groupId>
<artifactId>test-watch-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<includes>
<include>**/*.java</include>
</includes>
<excludes>
<exclude>**/target/**</exclude>
</excludes>
<testPattern>**/*Test.java</testPattern>
<parallel>true</parallel>
<smartSelection>true</smartSelection>
</configuration>
</plugin>
</plugins>
</build>
Then run:
mvn test-watch-maven-plugin:test
The plugin watches your source files. Change anything, save, and tests re-run automatically.
Configuration
| Option | Default | Description |
|---|---|---|
includes | **/*.java | Files to watch for changes |
excludes | — | Patterns to ignore (e.g., **/target/**) |
testPattern | **/*Test.java | Pattern to identify test files |
parallel | true | Run tests in parallel |
smartSelection | true | Only run tests affected by changed files |
How It Works
- Plugin starts a file watcher on your configured source paths
- When a
.javafile changes, the plugin identifies which test files to run usingtestPattern - With
smartSelection: true, only tests matching changed source files are executed - Tests are dispatched to Maven's invoker framework (parallel when enabled)
- Results are aggregated into a clean summary
vs Alternatives
| test-watch-maven-plugin | Infinitest | mvn test -pl ... | Gradle --continuous | |
|---|---|---|---|---|
| Watch mode | ✅ | ✅ | ❌ | ✅ |
| Maven-native | ✅ | ❌ (IDE plugin) | ✅ | ❌ |
| IDE-agnostic | ✅ | ❌ | ✅ | ✅ |
| Smart selection | ✅ | ✅ | ❌ | ❌ |
| Parallel tests | ✅ | ❌ | ✅ | ✅ |
| CLI-first | ✅ | ❌ | ✅ | ✅ |
Contributing
Contributions welcome. Please open issues or PRs against this repository. Follow existing code style and include tests for new behavior.
License
MIT — see LICENSE.