Maven 发布准备因 Git 子模块而失败

Ion*_*nut 6 git maven git-submodules maven-release-plugin

我们有一个多模块的 Maven 项目,其中的模块也是 Git 的子模块。

当我在父项目上执行 mvn release:prepare 时,出现此错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project big-project-parent: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-add command failed.
[ERROR] Command output:
[ERROR] fatal: Pathspec 'basic-utils\pom.xml' is in submodule 'basic-utils'
Run Code Online (Sandbox Code Playgroud)

Von*_*onC 0

首先检查,正如这里提到的,是commitByProject可以帮助的(maven release 2.0+)

mvn release:prepare -DcommitByProject=true
Run Code Online (Sandbox Code Playgroud)

MRELEASE-726指出 Git 支持在 2.5.x 中得到了改进,因此请确保使用最新的 Maven 版本插件 3.0+。