nx
nx copied to clipboard
feat(maven): add batch executor for multi-task Maven execution
Current Behavior
The Maven plugin currently executes each Nx task individually, requiring a separate Maven process invocation for each target. This can result in significant performance overhead when running multiple Maven tasks, especially in monorepos with many modules.
Expected Behavior
With this change, the Maven plugin now supports batch execution of multiple tasks with identical phase/goals combinations in a single Maven process invocation. Tasks are intelligently grouped by their target configuration, reducing process overhead while maintaining per-task result tracking.
Changes Made
This implementation introduces:
Core Batch Executor (TypeScript)
maven-batch.impl.ts: Batch executor for multi-task executionmaven.impl.ts: Single executor for individual task execution- Updated schema to support batch execution configuration
- TypeScript test coverage for both executors
Batch Runner (Kotlin)
NxMavenBatchRunner.kt: Main batch execution coordinatorMavenInvokerRunner.kt: Maven Invoker API integrationArgParser.kt: Command-line argument parsingMavenCommandResolver.kt: Maven executable detection (mvnw > mvn)MavenBatchOptions.kt: Data models for batch configuration
Features
- Task grouping by identical phase/goals combinations
- Automatic Maven executable detection (mvnw > mvn)
- Comprehensive error handling and result tracking
- Foundation for future Kotlin/Java enhancements