Uploaded image for project: 'Maven Release Plugin'
  1. Maven Release Plugin
  2. MRELEASE-960

release:prepare does not tag each module when using commitByProject with flat multimodule

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.5.3
    • Fix Version/s: None
    • Component/s: prepare
    • Labels:
      None

      Description

      Hi,

      Given the following project-setup with a single git repository for each artifact:

      • module 1 (depends on m2 and m3)
      • module 2 (depends on m3)
      • module 3
      • complete (aggregates all modules into a single deliverable)

      Based on my experience with other projects I'd expect to be able to perform a release in complete:

      [INFO] Checking dependencies and plugins for snapshots ...
      What is the release version for "commitByProject-m3"? (de.dev.eth0.commitByProject:commitByProject-m3) 1.0: :
      What is the release version for "commitByProject-m2"? (de.dev.eth0.commitByProject:commitByProject-m2) 1.0: :
      What is the release version for "commitByProject-m1"? (de.dev.eth0.commitByProject:commitByProject-m1) 1.0: :
      What is the release version for "complete"? (de.dev.eth0.commitByProject:complete) 1.0: :
      What is SCM release tag or label for "complete"? (de.dev.eth0.commitByProject:complete) complete-1.0: :
      What is the new development version for "commitByProject-m3"? (de.dev.eth0.commitByProject:commitByProject-m3) 1.1-SNAPSHOT: :
      What is the new development version for "commitByProject-m2"? (de.dev.eth0.commitByProject:commitByProject-m2) 1.1-SNAPSHOT: :
      What is the new development version for "commitByProject-m1"? (de.dev.eth0.commitByProject:commitByProject-m1) 1.1-SNAPSHOT: :
      What is the new development version for "complete"? (de.dev.eth0.commitByProject:complete) 1.1-SNAPSHOT: :

      But this fails as the commit command tries to commit the updated pom.xml of each project in a single command:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project complete: Unable to commit files
      [ERROR] Provider message:
      [ERROR] The git-add command failed.
      [ERROR] Command output:
      [ERROR] fatal: D:\Develop\commitByProject\commitByProject-m3\pom.xml: 'D:\Develop\commitByProject\commitByProject-m3\pom.xml' is outside repository

      The solution I found here is to use commitByProject (http://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.html#commitByProject). I'd expect, that this will simply split the command for each project and I'd be fine here.

      BUT: as far as I can see, this does not work with a flat project structure as the tagging is not done in each project but in the parent folder:

      [INFO] Checking in modified POMs...
      [INFO] Executing: cmd.exe /X /C "git add – pom.xml"
      [INFO] Working directory: D:\Develop\commitByProject-m3
      [INFO] Executing: cmd.exe /X /C "git status"
      [INFO] Working directory: D:\Develop\commitByProject-m3
      [INFO] Executing: cmd.exe /X /C "git add – pom.xml"
      [INFO] Working directory: D:\Develop\commitByProject-m2
      [INFO] Executing: cmd.exe /X /C "git status"
      [INFO] Working directory: D:\Develop\commitByProject-m2
      [INFO] Executing: cmd.exe /X /C "git add – pom.xml"
      [INFO] Working directory: D:\Develop\commitByProject-m1
      [INFO] Executing: cmd.exe /X /C "git status"
      [INFO] Working directory: D:\Develop\commitByProject-m1
      [INFO] Executing: cmd.exe /X /C "git add – pom.xml"
      [INFO] Working directory: D:\Develop\commitByProject-complete
      [INFO] Executing: cmd.exe /X /C "git status"
      [INFO] Working directory: D:\Develop\commitByProject-complete
      [INFO] Tagging release with the label complete-1.0...
      [INFO] Executing: cmd.exe /X /C "git tag -F C:\Users\foo\AppData\Local\Temp\maven-scm-134839918.commit complete-1.0"
      [INFO] Working directory: D:\Develop

      At this point I'd expect the release plugin to enter each module, create a tag and that's it. Instead the tag is only created in the parent of the complete parent (which is not in SCM).

      To test this, the following repositories can be forked:

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              amuthmann Alexander Muthmann
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: