Last Updated: February 25, 2016
· skuro

Fast multi-module maven builds

Big maven project will make you feel you're aging waiting them to complete. There are a couple of tricks you can use to speed up your build, starting with

alias qmvn="mvn clean install -T 4.0C"

The above will instruct maven to spin off four threads (NOTE: adjust the number to resemble how many physical cores your CPU has), splitting the build of submodules across them.

It also happens that you have multiple multimodules projects, and one depend on another so that you have to run two long builds instead of one. Usually you only develop on one project at a time, so that you don't really own the changes on the other project and might be safe to skip the tests on it, to just have an updated snapshot of what your colleagues have been developing:

alias qmvn="mvn clean install -DskipTests -T 4.0C"

WARN: some plugins are not certified as thread safe, YMMV

Say Thanks
Filed Under