apache / apache/maven-release

[MRELEASE-960] release:prepare does not tag each module when using commitByProject with flat multimodule

Open
#1,127 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
128
Forks
145
Avg merge
7h 7m
Merged PRs (30d)
3

Description

**[Alexander Muthmann](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=amuthmann)** opened **[MRELEASE-960](https://issues.apache.org/jira/browse/MRELEASE-960?redirect=false)** and commented

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:
* https://github.com/deveth0/commitByProject-complete
* https://github.com/deveth0/commitByProject-m1
* https://github.com/deveth0/commitByProject-m2
* https://github.com/deveth0/commitByProject-m3

---

**Affects:** 2.5.3

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.