Note that I’m switching to english for this blog entry but I’m not yet sure it will be always the case … I’m testing
After reporting a regression in M2 -> M3 upgrade (see MNG-4975) I discovered I didn’t understood how is computed the execution order of mojos in a Maven phase (Thanks Benjamin Bentmann).
As you know Maven is built around the notion of build lifecycle. You call a maven phase in your project and Maven will execute all phases to go up to the one you asked. For each phase it will execute a set of Mojos bound on it.
The question is what happens if several mojos (from the same or different plugins) are bound to the same phase. In which order are they executed ?
The reply is : in the order of declaration in the POM. Thus the important thing to understand is that the id used for an execution to bind a mojo to a phase isn’t used to compute this order.
And what about inheritance ? Executions of the parent are done before the child executions.
Our team will add a clear documentation about this in plugins configuration documentation. What is important to understand it is that there is no magic in Maven (just few holes in the documentation and we are doing our best to fill them).