Maven 2 & 3

Execution order is arbitrary if inheritance is involved

Details

  • Complexity:
    Intermediate
  • Number of attachments :
    2

Description

According to the documentation, "When multiple executions are given that match a particular phase, they are executed in the order specified in the POM, with inherited executions running first." I assume that the order of the inherited executions would be in the order specified in the parent POM, but the docs are unclear here.

However, in practice, it seems the ordering is as documented if there is no inheritance from the parent. But if there are plugins inherited, then the ordering is completely arbitrary, with the inherited plugins not necessarily coming first. I created a project that runs two plugins, both bound to the same phase, with one specified in the parent and one specified in the project. The parent-specified plugin does not run first.

  1. MNG-1499.patch
    10/Nov/05 12:40 PM
    1 kB
    David Jackman
  2. MNG-1499-b.patch
    10/Nov/05 1:32 PM
    7 kB
    David Jackman

Issue Links

Activity

Hide
David Jackman added a comment -

The attached patch fixes this problem. Instead of keeping the list of merged plugins for parent and child in a map, it keeps the list in a List. (It still uses the maps to make sure plugins are only executed once if mentioned in both parent and child.)

Show
David Jackman added a comment - The attached patch fixes this problem. Instead of keeping the list of merged plugins for parent and child in a map, it keeps the list in a List. (It still uses the maps to make sure plugins are only executed once if mentioned in both parent and child.)
Hide
David Jackman added a comment -

After further inspection, I realized that the ModelUtils.mergePluginDefinitions method had the same problem. The second attached patch fixes the problem there as well. This patch also adds unit tests to cover these changes.

Show
David Jackman added a comment - After further inspection, I realized that the ModelUtils.mergePluginDefinitions method had the same problem. The second attached patch fixes the problem there as well. This patch also adds unit tests to cover these changes.
Hide
John Casey added a comment -

Applied. Thanks, David.

Show
John Casey added a comment - Applied. Thanks, David.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: