Backend Development 8 min read

Which Build Tool Reigns Supreme? Maven vs Gradle vs mvnd Performance Showdown

An in‑depth comparison of Maven, Gradle, and the Maven Daemon (mvnd) examines their features, configuration differences, and real‑world build performance on Spring Boot projects, revealing that Gradle delivers the fastest packaging times while offering simpler, more readable build scripts.

macrozheng
macrozheng
macrozheng
Which Build Tool Reigns Supreme? Maven vs Gradle vs mvnd Performance Showdown

1. mvnd Introduction

mvnd stands for Maven Daemon, a sub‑project of Apache Maven that extends Maven by running one or more daemon processes to execute builds.

2. Gradle Introduction

Gradle is a next‑generation open‑source automation build tool known for its efficiency and flexibility, widely used in Java development.

Gradle Advantages

Better syntax experience, avoiding cumbersome XML configuration.

Fast build speed by reusing previous outputs, processing only changed inputs, and parallel task execution.

Logic can be written directly in scripts, offering higher flexibility than Maven.

Official build tool for Android, supporting many popular languages and technologies.

Native compatibility with Maven configurations, which Maven cannot achieve in reverse.

Rapid version updates.

3. Gradle Usage

In IntelliJ IDEA you can create a Gradle project; for example, creating a Spring Boot project as shown below.

Gradle, like Maven, does not require separate installation; the default IDEA plugin suffices.

3.1 Switch Gradle to Domestic Mirror

To accelerate third‑party JAR downloads, create

init.gradle

in the

.gradle

folder and add the following configuration:

<code>allprojects {
  repositories {
    maven {
      url 'https://maven.aliyun.com/repository/public/'
    }
    mavenLocal()
    mavenCentral()
  }
}
</code>
Note: Set the domestic mirror before creating the project so that Spring Boot initialization uses the faster source.

3.2 Project Dependency File Comparison

Maven uses

pom.xml

while Gradle uses

settings.gradle

and

build.gradle

. The

build.gradle

file contains the specific configuration for a single project:

<code>plugins {
    id 'org.springframework.boot' version '2.5.8'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
    useJUnitPlatform()
}
</code>

3.3 Packaging Projects

Both Maven and Gradle can package projects via IDEA's UI. Maven packaging screenshot:

Gradle packaging screenshot:

4. mvnd Usage

mvnd requires installation; see the detailed guide at https://juejin.cn/post/7046187614990237732.

5. Performance Comparison

We built two Spring Boot 2.5.8 + Java 8 projects to compare packaging times.

5.1 Maven Packaging Performance

Maven first‑time packaging took 6.524 seconds.

5.2 mvnd Packaging Performance

mvnd first‑time packaging took 4.832 seconds, a 135% improvement over Maven.

5.3 Gradle Packaging Performance

Gradle first‑time packaging took 1.560 seconds, a 418% improvement over Maven and 300% over mvnd.

Extension: Gradle Packaging Output Directory

Conclusion

Although mvnd aims to bring Gradle‑like speed to Maven, the tests show that Gradle remains the fastest build tool, offering a 418% performance boost over Maven and a 300% boost over mvnd, while its build scripts are simpler and more readable, making it the most recommended project build tool.

JavaGradleMavenSpring Bootbuild performancemvnd
macrozheng
Written by

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.

0 followers
Reader feedback

How this landed with the community

login 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.