Maven: Ignore inter-module dependencies while running unit tests

Viewed 468

We have a large multi-module Maven project. I've been experimenting with speeding up our unit test builds using the -T option, with some positive results. However, there are some dependency paths in our project like this:

module A <- module B <- module C

where the unit tests for each module take 20-30 minutes. Since the -T option builds modules in their dependent order, this results in a 90 minute total build time. It would really speed up the build if I could compile all the modules first, and then run the tests for A, B, and C in parallel. Eg. Something like this:

$ mvn -T 10 clean install -DskipTests
$ mvn -T 10 --ignore-dependencies test

Question: Does Maven have support for this out of the box?

I've been toying with the idea of writing a tiny script that will parse the output of mvn dependency:tree and invoke "mvn test -pl A", "mvn test -pl B" and so forth in parallel, but obviously if Maven has an out-of-the-box solution that'd be preferable.

We are using Jenkins, so if there's some Jenkins plugin out there or feature of Jenkins that I've missed that supports this, that could help a lot!

Note: Speeding up the unit tests for A, B and C will take a significant amount of work, and there's no guarantee that the tests within an individual module are parallelizable

1 Answers
Related