Skip to content
Smitheo

Faster Builds in AEM: Save Time with Maven Daemon

How Maven Daemon speeds up Maven-based AEM builds, with installation steps and the results we measured: up to 2x faster.

By Matija Kovacek · Published

Last updated

Slow build times can hinder development productivity and delay project timelines. In this post, we explore how leveraging Maven Daemon can significantly reduce AEM build times, making your workflows faster and more efficient. Learn step-by-step methods to optimize your builds, reduce downtime, and enhance your development experience. With results showing up to 2x faster builds, this approach is a game-changer for developers and businesses alike.

Recently we found a tool to speed up the build time of your Maven-based projects.

Maven Daemon is a maven wrapper that provides faster build time.

Some facts about Maven Daemon:

  • build executes in a long-living background process
  • native executable
  • use multiple CPU cores to build modules in parallel

More information about Maven Daemon can be found in the GitHub repository.

Maven Daemon Installation

Use SDK or Brew to install Maven Daemon

$ sdk install mvnd

$ brew install mvndaemon/homebrew-mvnd/mvnd

Verify the installation with

➜ ~ mvnd --version
mvnd native client 0.2.0-darwin-amd64 (0cd0b3f04692b7970fda06c206c1fbaac68fe9ce)
Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jansi.osx.OsXNativePty
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/mvnd/HEAD-1c610c3/libexec/mvn
Java version: 15.0.1, vendor: N/A, runtime: /usr/local/Cellar/openjdk/15.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"

Maven vs Maven Daemon build time comparison

We will compare build times for the Adobe Experience Manager (AEM) project for testing purposes. The project was built 2x times before measurement.

This measurement is not perfect, since a lot of factors can affect the final build time (+- a few seconds), but it's fair enough to see a difference. For testing purposes, we have used AEM Project Archetype version 24.

  • mvn clean install vs mvnd clean install
  • mvn: 26.586 s
  • mvnd: 12.654 s
mvn clean install
 
[INFO] Reactor Summary for mysite 1.0.0-SNAPSHOT:
[INFO]
[INFO] mysite ............................................. SUCCESS [  0.242 s]
[INFO] My Site - Core ..................................... SUCCESS [  6.994 s]
[INFO] My Site - UI Frontend .............................. SUCCESS [ 11.099 s]
[INFO] My Site - Repository Structure Package ............. SUCCESS [  0.795 s]
[INFO] My Site - UI apps .................................. SUCCESS [  3.890 s]
[INFO] My Site - UI content ............................... SUCCESS [  1.672 s]
[INFO] My Site - UI config ................................ SUCCESS [  0.105 s]
[INFO] My Site - All ...................................... SUCCESS [  0.138 s]
[INFO] My Site - Dispatcher ............................... SUCCESS [  0.080 s]
[INFO] My Site - UI Tests ................................. SUCCESS [  0.274 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  26.586 s
[INFO] Finished at: 2020-12-30T11:59:11+01:00
[INFO] -------------------------------------------------------------------
mvnd clean install
 
[INFO] Reactor Summary for mysite 1.0.0-SNAPSHOT:
[INFO]
[INFO] mysite ............................................. SUCCESS [  0.016 s]
[INFO] My Site - Core ..................................... SUCCESS [  4.300 s]
[INFO] My Site - UI Frontend .............................. SUCCESS [ 10.442 s]
[INFO] My Site - Repository Structure Package ............. SUCCESS [  0.178 s]
[INFO] My Site - UI apps .................................. SUCCESS [  1.126 s]
[INFO] My Site - UI content ............................... SUCCESS [  0.911 s]
[INFO] My Site - UI config ................................ SUCCESS [  0.156 s]
[INFO] My Site - All ...................................... SUCCESS [  0.107 s]
[INFO] My Site - Dispatcher ............................... SUCCESS [  0.078 s]
[INFO] My Site - UI Tests ................................. SUCCESS [  0.063 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12.654 s (Wall Clock)
[INFO] Finished at: 2020-12-30T11:59:58+01:00
[INFO] -------------------------------------------------------------------
  • mvn clean install -PautoInstallPackage vs mvnd clean install -PautoInstallPackage
  • mvn: 29.582 s
  • mvnd: 12.995 s
mvn clean install -PautoInstallPackage
 
[INFO] Reactor Summary for mysite 1.0.0-SNAPSHOT:
[INFO]
[INFO] mysite ............................................. SUCCESS [  0.223 s]
[INFO] My Site - Core ..................................... SUCCESS [  7.354 s]
[INFO] My Site - UI Frontend .............................. SUCCESS [ 11.338 s]
[INFO] My Site - Repository Structure Package ............. SUCCESS [  0.826 s]
[INFO] My Site - UI apps .................................. SUCCESS [  4.343 s]
[INFO] My Site - UI content ............................... SUCCESS [  2.885 s]
[INFO] My Site - UI config ................................ SUCCESS [  0.454 s]
[INFO] My Site - All ...................................... SUCCESS [  0.346 s]
[INFO] My Site - Dispatcher ............................... SUCCESS [  0.061 s]
[INFO] My Site - UI Tests ................................. SUCCESS [  0.374 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  29.582 s
[INFO] Finished at: 2020-12-30T12:06:29+01:00
[INFO] -------------------------------------------------------------------
mvnd clean install -PautoInstallPackage
 
[INFO] Reactor Summary for mysite 1.0.0-SNAPSHOT:
[INFO]
[INFO] mysite ............................................. SUCCESS [  0.005 s]
[INFO] My Site - Core ..................................... SUCCESS [  4.004 s]
[INFO] My Site - UI Frontend .............................. SUCCESS [ 10.288 s]
[INFO] My Site - Repository Structure Package ............. SUCCESS [  0.177 s]
[INFO] My Site - UI apps .................................. SUCCESS [  1.433 s]
[INFO] My Site - UI content ............................... SUCCESS [  1.010 s]
[INFO] My Site - UI config ................................ SUCCESS [  0.292 s]
[INFO] My Site - All ...................................... SUCCESS [  0.227 s]
[INFO] My Site - Dispatcher ............................... SUCCESS [  0.079 s]
[INFO] My Site - UI Tests ................................. SUCCESS [  0.053 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12.995 s (Wall Clock)
[INFO] Finished at: 2020-12-30T12:08:30+01:00
[INFO] ------------------------------------------------------------------------

Note Your AEM project build will fail with Maven Daemon if you use bnd-maven-plugin version older than 5.1.0

[ERROR] Failed to execute goal biz.aQute.bnd:bnd-maven-plugin:5.0.0

Conclusion

As test results show, Maven Daemon build time is approximately 2x faster than normal maven. Installation is pretty straightforward and so far didn't notice any downsides, so why not use it and save some time?


Related: Slow builds are often a symptom of wider platform issues. Our AEM audit looks at the whole build and delivery pipeline, and our AEM development services cover the fixes. And if build time is the bottleneck for your whole site, Edge Delivery Services takes the build off the delivery path entirely.

Need help with something like this?

Tell us what you want to automate, fix or build.

Start a project