Maven 3 Multithreading

Maven 3 multithreading works very well – as long as your plugins support it!  It’s still in an experimental mode but we are using it on our project to cut our build times in half.  And its much easier to implement than Ant’s parallel thread functionality.    On another project with Ant I multithreaded our build  – would take out almost 25% with parallelizing ant builds.  Maven claims a 50% reduction and I believe it.

So . . .good news – it works great.

Bad news – not all plugins are set up for multithreading yet (from Maven), like sonar, so it can’t be used it in a full build process yet.  You could probably write a two-step process though; one multithreaded and one not.

Running

mvn -T 4 clean install –>ran our build with 4 total threads, cuts build time almost in half!

I have an 8-core machine, so if I run it with one thread per core:

mvn –T 1C clean install –> goes even faster, 8 threads on my machine and saved almost 75% of the time needed to build!

Here’s Maven’s documentation:

https://cwiki.apache.org/MAVEN/parallel-builds-in-maven-3.html

Comments are closed.