apache / apache/maven

[MNG-6295] Inherited plugins are not properly ordered after merging with profile plugins in some special cases

Open
#7,572 5 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[kostd](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=kostd)** opened **[MNG-6295](https://issues.apache.org/jira/browse/MNG-6295?redirect=false)** and commented

See attached repro:
In some specific cases inherited executions order (on single phase) is corrupted after merge with executions from profile.

1. Steps to reproduce:

1.1. cd to mng-4416-reproducer/server-app/env-modules/child-with-profile-disabled/
1.2. mvn initialize:

```
[INFO] ------------------------------------------------------------------------
[INFO] Building child-with-profile-disabled 3.20.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.3:run (first-execution-in-grandparent-pom) @ child-with-profile-disabled ---
[INFO] Executing tasks
[echo] first-execution-in-grandparent-pom
[INFO] Executed tasks
[INFO]
[INFO] --- maven-antrun-plugin:1.3:run (second-execution-in-grandparent-pom) @ child-with-profile-disabled ---
[INFO] Executing tasks
[echo] second-execution-in-grandparent-pom
[INFO] Executed tasks
[INFO]
[INFO] --- gmaven-plugin:1.5-jenkins-3:execute (single-execution-in-parent-pom) @ child-with-profile-disabled ---
single-execution-in-parent-pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
```

U can see expected plugin execution ordering: grandparent executions first, parent executions after.

1.3. cd to mng-4416-reproducer/server-app/env-modules/child-with-profile-enabled/
1.4. mvn initialize:

```

[INFO] ------------------------------------------------------------------------
[INFO] Building child-with-profile-enabled 3.20.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- gmaven-plugin:1.5-jenkins-3:execute (single-execution-in-parent-pom) @ child-with-profile-enabled ---
single-execution-in-parent-pom
[INFO]
[INFO] --- maven-antrun-plugin:1.3:run (first-execution-in-grandparent-pom) @ child-with-profile-enabled ---
[INFO] Executing tasks
[echo] first-execution-in-grandparent-pom
[INFO] Executed tasks
[INFO]
[INFO] --- maven-antrun-plugin:1.3:run (second-execution-in-grandparent-pom) @ child-with-profile-enabled ---
[INFO] Executing tasks
[echo] second-execution-in-grandparent-pom
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
```

As you see this is affected execution order: parent first, grandparent after. It doesn`t metter, what grandparent-parent
order consider to correct, but order _must not_ be changed when profile activated!

2. Reproduced on environment:
- OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
- Default locale: ru_RU, platform encoding: Cp1251
- Java version: 1.8.0_77, vendor: Oracle Corporation
- Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-13T23:10:27+03:00)

3. Special conditions to reproduce:

3.1. plugin in test-profile (parent/pom.xml) must be the same as plugin defined before affected executions(grandparent/pom.xml).
That is, in our case maven-compiler-plugin and maven-compiler-plugin

3.2. affected plugins must have different types: maven-antrun-plugin in grandparent and gmaven-plugin in parent. Tried
with gmaven-plugin on grandparent -- cant reporduce.

3.3. depends on directory structure. Tried in flat structure -- cant reproduce.

---

**Affects:** 3.3.1

**Attachments:**
- [mng-4416-reproducer.zip](https://issues.apache.org/jira/secure/attachment/12893957/mng-4416-reproducer.zip) (_5.68 kB_)

**Issue Links:**
- [MNG-5987](https://issues.apache.org/jira/browse/MNG-5987) Document the algorithm calculating the order of plugin executions inside a phase.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.