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)