Parent snapshot version is not rewritten to resolved non-snapshot version 
during release:prepare
------------------------------------------------------------------------------------------------

                 Key: MRELEASE-449
                 URL: http://jira.codehaus.org/browse/MRELEASE-449
             Project: Maven 2.x Release Plugin
          Issue Type: Bug
          Components: prepare
    Affects Versions: 2.0-beta-9
            Reporter: Steve Gilbert
            Priority: Critical
         Attachments: maven-release-rewrite-parent-bug.patch, 
parent_version_rewrite_bug.zip

When a pom has a parent specified with a snapshot version, when "mvn 
release:prepare" is executed, the version entered by the user when prompted to 
resolve the parent version is not used when the pom is rewritten.  The parent 
version remains at the snapshot version in the rewritten pom.

This happens in dry run mode and normal mode.

I will attach a zip file with a simple example/test case that shows the bug.  
The steps to reproduce using the zip file:
1. cd to parent
2. execute "mvn install"
3. cd to ../child
4. execute "mvn -DdryRun=true release:prepare" answering "yes" to the first
   "resolve dependencies?" question and then answering with the default to
   all the other questions
5. cat pom.xml.tag noticing the parent SNAPSHOT version has not been replaced

The cause of this appears to be in AbstractRewritePomsPhase.rewriteParent.  
This method only consults the mappedVersions Map, however when the release 
plugin is executed from the command line and the user enters the version number 
to resolve the snapshot dependency (even using the default provided by the 
release plugin) the values are stored in the resolvedSnapshotDependencies Map 
only.

I've modified the code to consult both Maps which is what other methods in the 
class do when rewriting dependency snapshot revisions.  I have provided a patch 
with the modified code.  The patch also contains a new test method in 
RewritePomsForReleasePhaseTest that will fail without the patch and pass with 
it.

The patch was taken from maven-release 2.0-beta-9 and can be applied with
{code}
patch -p0 < ~/maven-release-rewrite-parent-bug.patch
{code}


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

        

Reply via email to