You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jason van Zyl (JIRA)" <ji...@codehaus.org> on 2009/12/30 03:27:55 UTC

[jira] Closed: (MNG-3674) originalModel in MavenProject has shallow clones of plugin instances and can be polluted when plugin versions are resolved

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

Jason van Zyl closed MNG-3674.
------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 2.x)
                   3.x

> originalModel in MavenProject has shallow clones of plugin instances and can be polluted when plugin versions are resolved
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MNG-3674
>                 URL: http://jira.codehaus.org/browse/MNG-3674
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: General, Plugins and Lifecycle
>    Affects Versions: 2.0.9
>            Reporter: John Casey
>             Fix For: 3.x
>
>
> This is NOT a regression; it's always been this way. Plugin instances are reused when ModelUtils.cloneModel(..) is called, rather than making a copy with the same plugin information. Since the plugin manager modifies that Plugin instance when it resolves a missing version, that modification will be reflected in the originalModel copy that lives in the MavenProject instance. This could be an issue because that originalModel is supposed to be a pristine copy of the POM as it was read - uninterpolated, uninherited, without any profile information injected, and without any modifications by the plugin manager, lifecycle executor, or any other component.
> This could affect POM information as it's written out by various plugins during a build, maybe including the POM copy that lands in META-INF of the finished artifact.
> The quickest solution to this would be to stop reusing the ModelInheritanceAssembler logic behind the scenes of ModelUtils.cloneModel(..) and instead serialize/deserialize the model instance to/from a StringWriter/Reader. This would leverage the generated formatters and parsers from maven-model to allow us to avoid rewriting that logic for the clone operation.

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