[英]maven-release-plugin in multi-module project having a seperate git repository for each module
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?我想知道是否可以在每个模块都有自己的 git 存储库的多模块项目中使用 maven-release-plugin? Something like this:像这样的东西:
parent/
.git/
pom.xml
module1/
.git/
pom.xml
I set up a simple test (under linux) and it fails for the "git add" command (simplyfied):我设置了一个简单的测试(在 linux 下),但“git add”命令失败了(简化):
cd parent && git add -- pom.xml /.../module1/pom.xml
The error message is错误信息是
fatal: /.../module1/pom.xml: '/.../module1/pom.xml' is outside repository
I understand that this git command can't work.我知道这个 git 命令不能工作。 Is maven-release-plugin able to do a seperate "git add" command for each repository? maven-release-plugin 是否能够为每个存储库执行单独的“git add”命令?
Just for the case the answer is NO: Assume i only have a single git repository.对于这种情况,答案是否定的:假设我只有一个 git 存储库。 Does it matter whether i use a flat hierarchy or a nested one?我使用平面层次结构还是嵌套层次结构有关系吗?
Are there any other options for automated versioning/releasing and keeping multiple git repositories?是否还有其他选项可用于自动版本控制/发布和保留多个 git 存储库?
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).自 maven-release-plugin 2.0-beta-5 以来,他们添加了一个名为commitByProject的新属性,在我的情况下(恰好就是您的情况)让我们为每个项目提交每个子模块(从根 pom 引用“git submodule add”策略)。 And this gets the job done!!这完成了工作!!
mvn release:prepare -DcommitByProject=true mvn 发布:准备 -DcommitByProject=true
You can use git submodules to have other git repositories inside your git repository.您可以使用 git 子模块在您的 git 存储库中拥有其他 git 存储库。 But if your module1
have a dependency to parent
through maven (ie <parent>
or parent has dependencyManagement), there seems like module1 isn't really a standalone module and should not have it's own repository in my opinion.但是,如果您的module1
通过 maven 依赖于parent
(即<parent>
或 parent 具有 dependencyManagement),那么 module1 似乎并不是真正的独立模块,在我看来不应该拥有自己的存储库。
About hierarchy I prefer nested ones to more easily see parent and modules.关于层次结构我更喜欢嵌套的层次结构,以便更容易地看到父级和模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.