Maven: how to do parallel builds?

Hans-Peter Störr picture Hans-Peter Störr · Feb 24, 2009 · Viewed 75.6k times · Source

When you build with maven on a multicore / multi-CPU machine it would often be possible to build different subprojects in parallel. Is there a way to do this with maven? Is there a plugin for this / whatever?

Answer

hallidave picture hallidave · Jul 23, 2010

Maven 3 (as of beta 1) now supports parallel builds as an experimental feature.

For example,

mvn -T 4 clean install # Builds with 4 threads
mvn -T 1C clean install # 1 thread per cpu core
mvn -T 1.5C clean install # 1.5 thread per cpu core

Full documentation can be found on the Maven wiki: Parallel builds in Maven 3 - Apache Maven - Apache Software Foundation.