Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
2.2.1
-
None
-
None
-
None
Description
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:
<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>
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.