You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "John Casey (JIRA)" <ji...@codehaus.org> on 2008/04/16 16:50:55 UTC

[jira] Commented: (MNG-3528) Order of executing plugins in maven 2.0.9

    [ http://jira.codehaus.org/browse/MNG-3528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=131004#action_131004 ] 

John Casey commented on MNG-3528:
---------------------------------

It should be a validation error to have two plugin entries in the build section of your POM that reference the same plugin. Since you were able to add two plugin entries like the above description, this is what actually needs to be fixed. Having two plugin entries will inevitably lead to problems with users thinking they are looking at the whole configuration for a plugin when they are in fact looking at only part of it (and the rest is scrolled off-page).

> 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