Maven: how to do parallel builds

build-automationbuild-processmaven-2

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?

Best Answer

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.