Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
2.0.9
-
None
-
None
-
Maven 2.0.9
Description
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
]
SECOND
[INFO] [: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
]
FIRST
[INFO] [:second
]
SECOND
Attachments
Attachments
Issue Links
- duplicates
-
MNG-3522 Cannot define Mojo execution order explicitly
- Closed