简体   繁体   English

多模块项目中的 maven-release-plugin,每个模块都有一个单独的 git 存储库

[英]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.

相关问题 发布托管在单个Git存储库中的多模块Maven项目 - Releasing a multi-module Maven project hosted in single Git repository 使用 Git 发布多模块 maven 项目 - Releasing a multi-module maven project with Git 在Windows上使用git发布多模块maven项目 - Multi module maven project release with git on Windows Maven-release-plugin部署目标在git存储库中具有顶级文件夹的项目上失败 - maven-release-plugin deploy goal fails on project with folder at top level in git repository 有没有办法将多模块 Maven 项目拆分为不同的 Git 存储库? - Is there a way to split a multi-module Maven project into different Git repositories? maven-release-plugin是否将标签推送到远程Git存储库? - Does maven-release-plugin push tags to remote Git repository? 配置 maven-release-plugin 将版本更改推送到 git 存储库? - Configure maven-release-plugin to push version changes to git repository? 使用maven-release-plugin wit Git - Using maven-release-plugin wit Git 具有子模块构建的Jenkins / Maven多模块,发布版本失败 - Jenkins / Maven Multi-Module with submodule build, fails the release build git与maven-release-plugin和buildnumber-maven-plugin - git with maven-release-plugin and buildnumber-maven-plugin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM