多模块项目中的maven-release-plugin,每个模块都有单独的git存储库 [英] maven-release-plugin in multi-module project having a seperate git repository for each module

查看:121
本文介绍了多模块项目中的maven-release-plugin,每个模块都有单独的git存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有可能在每个模块都有其自己的git存储库的多模块项目中使用maven-release-plugin?像这样:

I wonder if it's possible to use the maven-release-plugin in a multi module project where each module has its own git repository? Something like this:

parent/
  .git/
  pom.xml
module1/
  .git/
  pom.xml

我设置了一个简单的测试(在linux下),对于"git add"命令(简化)它失败了:

I set up a simple test (under linux) and it fails for the "git add" command (simplyfied):

cd parent && git add -- pom.xml /.../module1/pom.xml

错误消息是

fatal: /.../module1/pom.xml: '/.../module1/pom.xml' is outside repository

我知道此git命令无法正常工作.Maven-release-plugin能够为每个存储库执行单独的"git add"命令吗?

I understand that this git command can't work. Is maven-release-plugin able to do a seperate "git add" command for each repository?

对于这种情况,答案是否定的:假设我只有一个git存储库.是使用扁平层次结构还是嵌套层次结构都重要?

Just for the case the answer is NO: Assume i only have a single git repository. Does it matter whether i use a flat hierarchy or a nested one?

是否还有其他选项可以自动进行版本控制/发布并保留多个git存储库?

Are there any other options for automated versioning/releasing and keeping multiple git repositories?

推荐答案

从maven-release-plugin 2.0-beta-5开始,他们添加了一个名为

Since maven-release-plugin 2.0-beta-5 they added a new property called commitByProject that in my case (that happens to be exactly your case) let us commit per project each submodule (referenced from root pom with 'git submodule add' strategy). And this gets the job done!!

MVN版本:prepare -DcommitByProject = true

mvn release:prepare -DcommitByProject=true

这篇关于多模块项目中的maven-release-plugin,每个模块都有单独的git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆