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
Issue Type: Bug
Components: General, Plugins and Lifecycle
Affects Versions: 2.0.9
Reporter: John Casey
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