0

I'm working a very big maven project, which has more than 400 modules. In order to make it build faster:

mvn install -T4

Which fails, because some of the modules are dependent with each other, they must be placed together.

But most of the other modules are independent, is there any way to keep some of the modules building sequence, but others parallel?

Freewind
  • 193,756
  • 157
  • 432
  • 708

1 Answers1

0

The parallel build feature of Maven takes dependencies into account. I.e., if a module is dependant on another, they will always run in sequence. This automatic ordering is the most important feature of the Maven reactor.

Module B is dependant on Module A if:

  • B has a dependency on A (i.e. A is listed in the dependency block of B). Note that the coordinates must exactly match, i.e. a common error is to have a wrong version in the dependency section. (You can use the Reactor Module Convergence-Rule of the enforcer plugin.
  • A is a plugin that B uses (although it is usually bad style to define a plugin in the same reactor that uses it - the only valid exception is if B is an integration test for A).
  • A is an extension that B uses (also bad style)
  • A is parent of B
  • A is in the dependencyManagement block of B in scope import

So, if your modules are not build in the correct order, your dependencies are not correctly specified (most common issue: you use something like dependency:copy with explicitly declared artifacts. In that case, use dependency:copy-dependencies instead)

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
blackbuild
  • 5,026
  • 1
  • 23
  • 35