Order of executing plugins in maven 2.0.9
-----------------------------------------
Key: MNG-3528
URL: http://jira.codehaus.org/browse/MNG-3528
Project: Maven 2
Issue Type: Bug
Components: Plugins and Lifecycle
Affects Versions: 2.0.9
Environment: Maven 2.0.9
Reporter: David Bernhard
Priority: Minor
Attachments: 209test.zip
Suppose you include a plugin like this:
<plugin>
<groupId>my.bug.test</groupId>
<artifactId>plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>first</id>
<phase>compile</phase>
<goals>
<goal>first</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>my.bug.test</groupId>
<artifactId>plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>second</id>
<phase>compile</phase>
<goals>
<goal>second</goal>
</goals>
</execution>
</executions>
</plugin>
Then SECOND will execute before FIRST. The reason is in
ModelUtils.java:MergePluginDefinitions the new definition is passed as parent
and the old as child - and the parent comes first in the merged executions.
However, this works correctly:
<plugin>
<groupId>my.bug.test</groupId>
<artifactId>plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>both</id>
<phase>test</phase>
<goals>
<goal>first</goal>
<goal>second</goal>
</goals>
</execution>
</executions>
</plugin>
I have included a tiny test case that demonstrates this. Here's my output:
[INFO] [compiler:compile]
[INFO] No sources to compile
[INFO] [:second {execution: second}]
SECOND
[INFO] [:first {execution: first}]
FIRST
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [:first {execution: both}]
FIRST
[INFO] [:second {execution: both}]
SECOND
--
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