You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Raphaël Piéroni (JIRA)" <ji...@codehaus.org> on 2009/04/12 00:40:00 UTC

[jira] Closed: (ARCHETYPE-235) DefaultPomManager.mergePoms ignores ordering of plugins

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

Raphaël Piéroni closed ARCHETYPE-235.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0-alpha-5

Patche applied since revision 764258

> DefaultPomManager.mergePoms  ignores ordering of plugins
> --------------------------------------------------------
>
>                 Key: ARCHETYPE-235
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-235
>             Project: Maven Archetype
>          Issue Type: Bug
>    Affects Versions: 2.0-alpha-4
>            Reporter: Christian Bauer
>             Fix For: 2.0-alpha-5
>
>         Attachments: maven-archetype-2.0-alpha-4-patch-19032009.patch
>
>
> when you invoke an archetype with attribute partial=true (<archetype-descriptor partial="true" .... ) the pom of the archetype-resources is merged with the existing pom.
> During the merge of build plugins the DefaultPomManager ignores the ordering of the plugins in the archetype (generatedModel).
> The DefaultPomManager uses the ordering of the map generatedPluginsByIds :
>             Map pluginsByIds = model.getBuild().getPluginsAsMap();
>             Map generatedPluginsByIds = generatedModel.getBuild().getPluginsAsMap();
>             Iterator generatedPluginsIds = generatedPluginsByIds.keySet().iterator();
>             while ( generatedPluginsIds.hasNext() )
>             {
>                 String generatedPluginsId = (String) generatedPluginsIds.next();
>                 if ( !pluginsByIds.containsKey( generatedPluginsId ) )
>                 {
>                     model.getBuild().addPlugin((Plugin) generatedPluginsByIds.get( generatedPluginsId )
>                     );
>                 }
>                 else
>                 {
>                     getLogger().warn( "Can not override plugin: " + generatedPluginsId );
>                 }
>             }
> When the build process depends on the ordering of the plugins it may fail.
> The solution is to iterate over the list of plugins instead of the map
>             Map pluginsByIds = model.getBuild().getPluginsAsMap();
>             List generatedPlugins = generatedModel.getBuild().getPlugins();
>             Iterator generatedPluginsIterator = generatedPlugins.iterator();
>             while ( generatedPluginsIterator.hasNext() )
>             {
>             	Plugin plugin = (Plugin)generatedPluginsIterator.next();
>                 String generatedPluginsId = plugin.getKey();
>                 if ( !pluginsByIds.containsKey( generatedPluginsId ) )
>                 {
>                     model.getBuild().addPlugin(plugin);
>                 }
>                 else
>                 {
>                     getLogger().warn( "Can not override plugin: " + generatedPluginsId );
>                 }
>             }

-- 
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