You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "miowang (JIRA)" <ji...@apache.org> on 2019/04/17 02:05:00 UTC

[jira] [Commented] (MNG-5987) Document the algorithm calculating the order of plugin executions.

    [ https://issues.apache.org/jira/browse/MNG-5987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16819658#comment-16819658 ] 

miowang commented on MNG-5987:
------------------------------

I've encountered the same issue, I do believe it should be documented better. here is my understanding after went through several code in maven.

When a maven build triggered, maven core will resolve all of the plugins from pom and parent poms, and put them in a list

For plugins binding to same phase, the execution order is base on order in the list actually. Most of the time it is same with the order user declared in his/her pom because maven core append user's plugins to the bottom of parents' plugins, while sometimes it's not. take the case below for example
 # user declares A, B, C, D in parent pom, all of them are binding to the same phase.
 # now user declares E, C, F and B in sub pom, E and F are also binding to the same phase

Then the order in resolved plugin list will be A, F, B, E, C, D.

*F will be executed before E.*

The reason is 
 # user can redeclare the plugins in sub pom, while maven core keeps the order they were declared in parent pom.
 # for any plugins declared before the re-declared plugin, maven core will put them before the re-declared plugin in resolved list

More details in [https://github.com/apache/maven/blob/master/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java#L241]

> Document the algorithm calculating the order of plugin executions.
> ------------------------------------------------------------------
>
>                 Key: MNG-5987
>                 URL: https://issues.apache.org/jira/browse/MNG-5987
>             Project: Maven
>          Issue Type: Improvement
>            Reporter: Christian Schulte
>            Priority: Critical
>
> Users continuously report issues regarding the order of plugin executions: repeating that this order is not expected to be guaranteed inside a phase is not convincing for them.
> The algorithm used to calculate the order of executions performed by Maven needs to be documented:
> - declaration order in the POM
> - inheritance merging from parent POM,
> - merging of profiles and other plugin containers,
> - the order of executions of multiple executions in the same lifecycle phase,
>  etc.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)