Maven Release Plugin
  1. Maven Release Plugin
  2. MRELEASE-449

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

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Duplicate
    • Affects Version/s: 2.0-beta-9
    • Fix Version/s: None
    • Component/s: prepare
    • Labels:
      None
    • Testcase included:
      yes
    • Patch Submitted:
      Yes
    • Number of attachments :
      3

      Description

      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

      patch -p0 < ~/maven-release-rewrite-parent-bug.patch
      
      1. maven-release-rewrite-parent-bug.patch
        10 kB
        Steve Gilbert
      2. MRELEASE-449.diff
        10 kB
        Gabriel Falkenberg

        Activity

        Hide
        Mike Youngstrom added a comment -

        Can this issue please get fixed with beta-10? it is the only think keeping me from using the release plugin.

        Show
        Mike Youngstrom added a comment - Can this issue please get fixed with beta-10? it is the only think keeping me from using the release plugin.
        Hide
        Dennis Lundberg added a comment -

        I can confirm that the sample project fails in the way that is described in this issue.

        What I can't understand is, how doing a release in this way could work outside a dry run. You can't release a parent from a child can you?

        Also parent 1.0 must be deployed prior to child 1.1 (specifying parent-1.0 as parent) being released.

        Show
        Dennis Lundberg added a comment - I can confirm that the sample project fails in the way that is described in this issue. What I can't understand is, how doing a release in this way could work outside a dry run. You can't release a parent from a child can you? Also parent 1.0 must be deployed prior to child 1.1 (specifying parent-1.0 as parent) being released.
        Hide
        Dennis Lundberg added a comment -

        Moving to a later version.

        Show
        Dennis Lundberg added a comment - Moving to a later version.
        Hide
        Gabriel Falkenberg added a comment - - edited

        I can confirm that the patch fixes the problem and have updated the patch to apply cleanly on trunk (revision 923664). The updated patch is called2 MRELEASE-449.diff

        Are there any plans to include a fix to this problem in a release?

        Show
        Gabriel Falkenberg added a comment - - edited I can confirm that the patch fixes the problem and have updated the patch to apply cleanly on trunk (revision 923664). The updated patch is called2 MRELEASE-449 .diff Are there any plans to include a fix to this problem in a release?
        Hide
        Tom Vaughan added a comment -

        Is there any movement on this? Was this issue folded in to a later release?

        Show
        Tom Vaughan added a comment - Is there any movement on this? Was this issue folded in to a later release?
        Hide
        Robert Scholte added a comment -

        Looking to the patch it seems that this has already been fixed as part of MRELEASE-317, so closing it as duplicate.

        Show
        Robert Scholte added a comment - Looking to the patch it seems that this has already been fixed as part of MRELEASE-317 , so closing it as duplicate .

          People

          • Assignee:
            Robert Scholte
            Reporter:
            Steve Gilbert
          • Votes:
            25 Vote for this issue
            Watchers:
            26 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: