Operations 10 min read

Boost Maven Build Speed with mvnd: Install, Configure, and Compare Performance

This guide explains what mvnd is, how to download and install it, configure Maven and environment variables, fix PowerShell encoding issues, and presents a detailed performance comparison showing multi‑module builds can be up to 5.5× faster than using traditional Maven.

Architecture Digest
Architecture Digest
Architecture Digest
Boost Maven Build Speed with mvnd: Install, Configure, and Compare Performance

What is mvnd?

mvnd (Maven Daemon) is a Maven‑compatible build tool introduced in 2023 that speeds up Maven builds by running them in a long‑living background daemon process. The daemon embeds Maven, reuses JVMs, caches plugin class loaders, and is built as a GraalVM‑compiled native executable for fast startup and low memory usage.

Key advantages of the mvnd architecture

The JVM that performs the actual build does not need to restart for each build.

Class loaders for Maven plugins are cached across builds, so plugin JARs are read only once (except SNAPSHOT versions).

JIT‑compiled native code is retained, reducing compilation time for repeated builds.

Download and installation

Download mvnd from the official Apache site: https://downloads.apache.org/maven/mvnd/. Choose the package that matches your operating system, extract the zip to a directory that does not contain non‑ASCII characters.

Configuration

Open config/mvnd.properties and set the path to your Maven settings.xml at the bottom of the file.

If you already have a Maven installation, you can point mvnd to the existing settings.xml or use the default mvnd/mvn/conf/settings.xml.

Set environment variables

Add the mvnd directory to MAVEN_HOME and include %MAVEN_HOME%\bin in the PATH variable.

Verify installation

Open a new console and run mvnd --version. The version number should be displayed, confirming a successful setup.

Performance comparison

Tests were performed on a laptop with an Intel(R) Core(TM) Ultra 5 125H (3.60 GHz, 14 cores/18 threads), 32 GB RAM, and a 1 TB SSD.

Maven commands

Multi‑module clean & package (19 modules): mvn clean package Multi‑module package without clean: mvn package Single‑module clean & package:

mvn clean package

mvnd commands

Multi‑module clean & package: mvnd clean package Multi‑module package without clean: mvnd package Single‑module clean & package: mvnd clean package Results:

Multi‑module clean & package: 65 s / 17 s ≈ 3.5× faster Multi‑module package without clean: 22 s / 4 s ≈ 5.5× faster Single‑module clean & package: 10 s / 5 s = 2× faster When using mvnd package, multiple modules are compiled in parallel, which explains the larger speedup compared to the single‑module case where only the daemon’s JVM optimization applies.

Fixing console encoding issues on Windows PowerShell

Set PowerShell’s output and input encoding to UTF‑8:

$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::InputEncoding = [System.Text.Encoding]::UTF8

For a permanent fix, add the same commands plus the Java tool option to your PowerShell profile ( $profile).

# Set encoding to UTF-8
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
# Set JAVA_TOOL_OPTIONS
$env:JAVA_TOOL_OPTIONS = "-Dfile.encoding=UTF-8"

Using mvnd in IntelliJ IDEA

Install the Maven Helper plugin from the JetBrains marketplace. After restarting IDEA, configure the plugin to use the mvnd executable. The Maven tool window will then show mvnd commands, and right‑clicking a project or module provides mvnd‑based build actions.

Source repository

GitHub:

https://github.com/apache/maven-mvnd
mavenIntelliJ IDEAbuild performancePowerShellmvnd
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

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.