[
https://jira.codehaus.org/browse/MNG-5539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=339959#comment-339959
]
David Eckel edited comment on MNG-5539 at 1/24/14 12:03 AM:
------------------------------------------------------------
Attached is an example project, consisting only of a simple pom.xml file.
Run "mvn validate" to see that the order that the plugins are executed is 1)
clean, 2) antrun. My expectation is that they would run in the order that they
are defined within the profile: 1) antrun, 2) clean.
was (Author: dvdckl):
Example project, consisting only of a simple pom.xml file.
> Profile plugin execution order is not preserved when merging into default
> PluginContainer
> -----------------------------------------------------------------------------------------
>
> Key: MNG-5539
> URL: https://jira.codehaus.org/browse/MNG-5539
> Project: Maven 2 & 3
> 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira