You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Christian Schulte (JIRA)" <ji...@apache.org> on 2016/03/03 08:12:18 UTC

[jira] [Closed] (MNG-5539) Profile plugin execution order is not preserved when merging into default PluginContainer

     [ https://issues.apache.org/jira/browse/MNG-5539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Schulte closed MNG-5539.
----------------------------------
    Resolution: Unresolved

> Profile plugin execution order is not preserved when merging into default PluginContainer
> -----------------------------------------------------------------------------------------
>
>                 Key: MNG-5539
>                 URL: https://issues.apache.org/jira/browse/MNG-5539
>             Project: Maven
>          Issue Type: Bug
>          Components: Plugins and Lifecycle, POM, Profiles
>    Affects Versions: 3.0.5, 3.1.0
>            Reporter: David Eckel
>            Priority: Minor
>         Attachments: mng-5539.zip
>
>
> The order of execution of plugins within a profile unexpectedly depends upon the order of plugin definitions outside of the profile if the profile references those same plugins, even if they do not specify executions in the same phase. In the following example pom snippet, when run with 'mvn validate', 'plugin-B-in-profile' will execute first, then 'plugin-A-in-profile', when the opposite execution - the order in which they were defined - was desired.
> {code:xml}
> <build>
>     <plugins>
>         <!-- if you swap the order of these two plugins or remove one, the order of the profile plugin execution will change -->
>         <plugin>
>             <artifactId>maven-jar-plugin</artifactId>
>         </plugin>
>         <plugin>
>             <artifactId>maven-antrun-plugin</artifactId>
>         </plugin>
>     </plugins>
> </build>
> <profiles>
>     <profile>
>         <activation>
>             <activeByDefault>true</activeByDefault>
>         </activation>
>         <build>
>             <plugins>
>                 <plugin>
>                     <artifactId>maven-antrun-plugin</artifactId>
>                     <executions>
>                         <execution>
>                             <id>plugin-A-in-profile</id>
>                             <phase>validate</phase>
>                             <goals>
>                                 <goal>run</goal>
>                             </goals>
>                         </execution>
>                     </executions>
>                 </plugin>
>                 <plugin>
>                     <artifactId>maven-clean-plugin</artifactId>
>                     <executions>
>                         <execution>
>                             <id>plugin-B-in-profile</id>
>                             <phase>validate</phase>
>                             <goals>
>                                 <goal>clean</goal>
>                             </goals>
>                         </execution>
>                     </executions>
>                 </plugin>
>                 <!-- Removing this plugin declaration will cause above plugins to run in a different order -->
>                 <plugin>
>                     <artifactId>maven-jar-plugin</artifactId>
>                 </plugin>
>             </plugins>
>         </build>
>     </profile>
> </profiles>
> {code}
> See {{org.apache.maven.model.profile.DefaultProfileInjector$ProfileModelMerger.mergePluginContainer_Plugins()}}. It's unclear to me if this algorithm is intentional to aggregate all plugin definitions in the same way that you cannot declare the same plugin more than once in a given PluginContainer, or if profiles should always have their execution order respected, regardless of plugin definitions outside of the profile.
> This may be a similar or the same issue as MNG-5478, but it's unclear due to lack of information.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)