You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Wim Deblauwe (JIRA)" <ji...@codehaus.org> on 2010/07/13 15:14:32 UTC

[jira] Updated: (MNG-4727) Allow ordering plugin execution via

     [ http://jira.codehaus.org/browse/MNG-4727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wim Deblauwe updated MNG-4727:
------------------------------

    Attachment: plugin_execution_order.patch

Added a patch for {{DefaultLifecyleExecutor.java}} that allows the above. It is a bit hackish because you need to start your {{<id>}} with "step-" to have the sorting kick in. I did this to avoid as much other issues as possible if you don't want this sorting.

I just tried it on a project of mine and it works perfectly. If you run maven with debug info, it will print out the order.

> Allow ordering plugin execution via <id/>
> -----------------------------------------
>
>                 Key: MNG-4727
>                 URL: http://jira.codehaus.org/browse/MNG-4727
>             Project: Maven 2 & 3
>          Issue Type: Improvement
>    Affects Versions: 2.2.1
>            Reporter: Wim Deblauwe
>            Assignee: Benjamin Bentmann
>         Attachments: plugin_execution_order.patch
>
>
> I would like to be able to deterministically order the execution of plugins bound to the same lifecycle phase. I have a project where I need to execute the antrun plugin, then the install4j-maven-plugin, again the antrun plugin and finally the rpm-maven-plugin.
> I would like to be able to do this:
> {code:xml}
> <plugin>
>   <artifactId>maven-antrun-plugin</artifactId>
>   <version>1.4</version>
>   <executions>
>     <execution>
>       <id>step-1-extract-tomcat6x</id>
>       <phase>package</phase>
>       <goals><goal>run</goal></goals>
>       <configuration>
>           ...
>       </configuration>
>     </execution>
>     <execution>
>       <id>step-3-extract-install4j-tar-gz-file</id>
>       <phase>package</phase>
>       <goals><goal>run</goal></goals>
>       <configuration>
>            ...
>       </configuration>
>     </execution>
>   </executions>
> </plugin>
> <plugin>
>   <groupId>com.google.code.maven-install4j</groupId>
>   <artifactId>maven-install4j-plugin</artifactId>
>   <version>0.2-mvn-2.2.1</version>
>   <executions>
>     <execution>
>       <id>step-2-build-installers</id>
>       <phase>package</phase>
>       <goals><goal>compile</goal></goals>
>     </execution>
>   </executions>
>   <configuration>
>        ...
>   </configuration>
> </plugin>
> <plugin>
>   <groupId>org.codehaus.mojo</groupId>
>   <artifactId>rpm-maven-plugin</artifactId>
>   <version>2.1-alpha-1</version>
>   <executions>
>     <execution>
>       <id>step-4-create-rpm</id>
>       <phase>package</phase>
>       <goals><goal>attached-rpm</goal></goals>
>     </execution>
>   </executions>
>   <configuration>
>        ...
>   </configuration>
> </plugin>
> {code}
> When defined like this, the execution order should be:
> # step-1-extract-tomcat6x
> # step-2-build-installers
> # step-3-extract-install4j-tar-gz-file
> # step-4-create-rpm
> With the current maven (2.2.1), you can do this if you order your plugins in the pom.xml correctly and you don't need the same plugin twice. Depending on the {{<id/>}} (with natural sorting on String) would allow to declare the same plugin twice.
> An alternative might be to add an additional element to {{<execution/>}}, like {{<order/>}} or something that only accepts a number.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira