Maven-mvnd: Drop-In Replacement for Faster Java Builds via Daemon & GraalVM

This article introduces Maven-mvnd (mvnd), a drop-in replacement for Apache Maven that uses a persistent daemon process and GraalVM native executables to dramatically accelerate build times, especially for multi-module projects, while maintaining full compatibility with existing Maven POM files and commands.

SpringMeng
SpringMeng
SpringMeng
Maven-mvnd: Drop-In Replacement for Faster Java Builds via Daemon & GraalVM

Maven-mvnd Introduction

Apache Maven is stable, reliable, and has a mature ecosystem, but its build speed becomes a bottleneck for larger projects — often forcing builds to run only on servers. Gradle offers faster builds via daemon processes and caching, yet its rapid version churn and steeper learning curve deter some teams.

Maven-mvnd (mvnd) is developed by the Apache Maven team, borrowing ideas from Gradle and Takari. It is a strengthened version of Maven that solves the slow-build problem without requiring developers to learn a new tool; if you know Maven, you can use mvnd immediately.

Pain Points Addressed

Slow build speed: Maven's main bottleneck is JVM initialization at the start of every build cycle. Loading thousands of classes and setting up the environment is especially costly in large, multi-module projects. mvnd maintains a long-running Maven daemon, avoiding repeated JVM startups.

High resource consumption: Each Maven build consumes CPU and memory for JVM startup. mvnd's daemon stays alive between builds, reducing waste — particularly beneficial in CI/CD pipelines with frequent builds.

Latency in frequent builds: Modern development demands fast feedback loops. Traditional Maven makes developers wait longer after code changes. mvnd accelerates the build process, shortening wait times and boosting productivity.

Multi-project build optimization: Organizations with many Maven projects see significant time savings. The daemon can be shared across multiple build requests, reducing per-project overhead.

Easy migration: mvnd usage mirrors traditional Maven almost exactly. No new syntax or POM changes are needed, making it a low-risk adoption for teams wanting performance gains without leaving the Maven ecosystem.

Key Features

Embeds Maven — no separate Maven installation required; seamless transition.

Actual builds run in a persistent background daemon process. If no idle daemon is available, multiple daemons can be spawned in parallel.

A single daemon instance handles multiple sequential requests from the mvnd client.

Built as a GraalVM native executable, it starts faster and uses less memory than a traditional JVM.

Architectural Advantages

The JVM running the actual build does not restart for each build, saving time.

JIT-compiled native code is retained in the daemon. Compared to Maven, JIT compilation time is reduced; optimized code is immediately available on repeated builds.

This applies not only to Maven core and plugin code, but also to all code from the JDK itself.

Installation Steps

Download

Releases:

https://github.com/mvndaemon/mvnd/releases
Download page screenshot
Download page screenshot

Install

Unzip the archive, then configure environment variables:

JAVA_HOME
MAVEN_HOME
MAVEN_MVND_HOME
Environment variable configuration screenshot
Environment variable configuration screenshot

Add the bin directory to PATH. Prerequisite: JAVA_HOME must exist.

PATH configuration screenshot
PATH configuration screenshot

Test

mvnd -v
Version output screenshot
Version output screenshot

Usage

Usage and parameters are identical to Maven. Replace mvn with mvnd:

Maven: mvn clean package mvnd:

mvnd clean package

Configuration

For maximum compatibility, reuse the existing Maven settings.xml.

Open $MAVEN_MVND_HOME/conf/mvnd.properties and append at the end:

maven.settings=F:/javaee/apache-maven-3.6.3/conf/settings.xml

If JAVA_HOME is not set, you can also specify the JDK path in this file.

mvnd.properties configuration screenshot
mvnd.properties configuration screenshot

Packaging Comparison

# maven packaging command
mvn clean package '-Dmaven.test.skip=true'
# mvnd packaging command
mvnd clean package '-Dmaven.test.skip=true'
Build time comparison screenshot
Build time comparison screenshot

The more sub-modules a project has, the more pronounced the speed advantage. For projects with many modules, mvnd can save significant time in test and production packaging.

Gradle remains another viable option for high-efficiency packaging; teams can adopt one or a mixed approach.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaPerformance OptimizationCI/CDbuild-toolMavenGraalVMdaemonmvnd
SpringMeng
Written by

SpringMeng

Focused on software development, sharing source code and tutorials for various systems.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.