Speed Up Maven Builds 10× with mvnd: GraalVM‑Powered Daemon Explained
This article introduces mvnd, a GraalVM‑based Maven daemon that runs as a persistent build service, explains how it achieves faster startup and parallel builds, and provides step‑by‑step installation, configuration, and usage instructions for Windows, macOS, and Linux.
Maven is often compared with Gradle , and its biggest drawback is slower build speed; the Apache Maven team created maven‑mvnd to make Maven faster.
Simple Introduction
mvnd does not rewrite Maven but embeds it as one or more Maven daemon processes that perform the actual build work. A daemon instance can serve multiple consecutive build requests from mvnd clients, and when no idle daemon is available it can spawn additional daemons in parallel.
Using GraalVM Instead of the JVM
mvnd is fast because it runs on GraalVM rather than the traditional JVM, resulting in quicker startup, lower memory usage, and no need to launch a new JVM for each build. Maven plugins are cached across builds, although SNAPSHOT versions are not.
Supporting JIT
The Just‑In‑Time (JIT) compilation feature of GraalVM is applied to Maven build jobs, dramatically reducing compilation time and making optimized code immediately available during repeated builds.
Parallel Builds
While Maven 3’s parallel build feature is still experimental and requires thread‑safe plugins, mvnd enables parallel builds out of the box using multiple CPU cores. You can switch to serial builds with the
-T1option if needed.
Simple Try
Installation
mvnd supports Linux, macOS, and Windows. Install it via package managers such as SDKMAN, Homebrew, or Chocolatey, or download a binary from the mvnd release repository. For Windows, the Chocolatey command is:
<code>choco install mvndaemon</code>Configuration
Configuration is straightforward. Ensure the
bindirectory is on
PATHif you installed manually. If you prefer not to set
JAVA_HOMEglobally, add
java.hometo
~/.m2/mvnd.propertiespointing to your JDK installation.
Usage
After installation, verify it with:
<code>mvnd --version</code>The output shows the mvnd version, the embedded Maven version, Java version, and system details. The command line mirrors Maven’s, so you can replace
mvnwith
mvndand use
mvnd --helpfor a full option list.
Parallel builds feel extremely fast, and console output has been improved.
With GraalVM acceleration, mvnd may extend Maven’s relevance and keep it competitive with Gradle. The project is worth watching for future developments from the Apache Maven community.
References
Takari (Maven lifecycle optimizer): http://takari.io/book/40-lifecycle.html
maven‑mvnd: https://github.com/apache/maven-mvnd
mvnd release repository: https://github.com/mvndaemon/mvnd/releases
mvnd configuration: https://github.com/mvndaemon/mvnd/blob/master/dist/src/main/distro/conf/mvnd.properties
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.