Boost Java Build Speed with Maven‑mvnd: Features, Installation & Usage
This article explains how Maven‑mvnd accelerates Java project builds by using a long‑running daemon to eliminate JVM startup overhead, reduces resource consumption, improves multi‑module builds, and provides step‑by‑step installation, configuration, and usage instructions with practical command examples.
Overview
Maven‑mvnd (abbreviated mvnd) is a daemon‑based Maven wrapper that keeps a long‑running Maven process alive between builds. By avoiding a fresh JVM start for each build, it reduces build time, CPU and memory usage, and latency, especially for large multi‑module projects.
Problems Addressed
Build speed bottleneck: Traditional Maven launches a new JVM for every build, loading many classes. mvnd reuses a daemon, eliminating repeated JVM startup.
High resource consumption: Each JVM start consumes CPU and RAM. The daemon stays alive, saving resources in CI/CD pipelines with frequent builds.
Frequent build latency: Faster builds shorten the feedback loop for developers.
Multi‑project build optimization: A shared daemon can serve multiple build requests, reducing pre‑build overhead for each project.
Easy migration: Works with existing Maven pom.xml files and command‑line syntax.
Key Features
Embedded Maven – no separate Maven installation required.
Long‑living background daemon; multiple daemons can be spawned if needed.
A single daemon instance can handle consecutive requests from mvnd clients.
Built with GraalVM native executables, which start faster and use less memory than a traditional JVM.
JIT‑compiled native code is retained between builds, reducing JIT overhead.
Installation
Download the latest release from:
https://github.com/mvndaemon/mvnd/releases
Extract the archive and configure the following environment variables: JAVA_HOME – path to a JDK.
MAVEN_HOME MAVEN_MVND_HOMEAdd the bin directory of the extracted distribution to PATH.
Verification
mvnd -vUsage
Run mvnd with the same arguments as Maven. For example, replace: mvn clean package with
mvnd clean packageConfiguration
To keep maximum compatibility, reuse the existing settings.xml. Edit /conf/mvnd.properties in the mvnd installation directory and add or modify the property pointing to your settings file:
maven.settings=F:/javaee/apache-maven-3.6.3/conf/settings.xmlPackaging Comparison
# Maven packaging command
mvn clean package -Dmaven.test.skip=true
# mvnd packaging command
mvnd clean package -Dmaven.test.skip=trueWhen a project contains many sub‑modules, mvnd shows a more pronounced speed advantage, making it suitable for large multi‑module builds, CI testing, and production packaging.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
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.
