如何拆分git repo并应用Maven子模块和Maven父级? [英] How to split up git repo and apply Maven submodules and Maven parent?

查看:335
本文介绍了如何拆分git repo并应用Maven子模块和Maven父级?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些有关如何配置多个repo的建议,以使它们共享一个Maven父级,并在Maven根项目中被配置为子模块.

I need some advice on how to configure multiple repo's such that they share a Maven parent and also are configured as submodules in a Maven root project.

我正在维护开源项目简单的Java Mail ,并且随着可选功能的发展,我打算将项目分成子模块,每个子模块都在自己的GIT存储库中.

I'm maintaining open source project Simple Java Mail and as there are optional functions that are becoming larger and larger, I'm planning to split the project up into sub-modules each in there own GIT repo.

  1. 我首先要担心的是,应该有一个共享的 Maven父母 配置,可处理所有默认测试和构建配置以及 默认的测试和实用程序依赖项.那是我可以做的一个额外的回购 想想.
  2. 下一步,轻松地构建和发布所有内容 版本号,我认为安装 Maven子模块 有用.如何在GIT仓库中进行设置?我的第一个念头 将是主/根Maven项目的另一个仓库,该仓库定义了 子模块,然后在同一子目录中检查此仓库和所有其他仓库 文件夹,主Maven项目将找到模块项目 与..\submodule-xyz相对文件夹.
  1. My first concern is that there should be a shared Maven parent config that handles all default test and build config as well as default test and utility dependencies. That is one extra repo I can think of.
  2. Next, to easily build and release everything together with the same version numbers, I thought having a Maven submodules setup would be useful. How can I set this up in GIT repo's? My first thought would be another repo for the main/root Maven project which defines the submodules, then checkout this and all other repo's in the same folder and the main Maven project would find the module projects with ..\submodule-xyz relative folders.

我之前已经配置了类似的设置,但是全部都在一个存储库中(在Subversion很好的旧时代).任何人都可以建议如何通过分离的回购协议来最好地解决这个问题吗?最好我为父pom和主/root pom有一个存储库(这很常见吗?).最好与git子模块结合使用吗?

I have configured a similar setup before, but that was all in a single repository (in the good old Subversion days). Can anyone please advise on how to approach this best with split up repo's? Preferably I would have one repo for the parent pom and the main/root pom (is that common?). Is it preferable to combine with git submodules?

推荐答案

术语模块"在这里有点重载.

The term module is a bit overloaded here.

是的,您可以在一个仓库中定义一个父pom,声明一个多模块maven项目,每个模块都引用一个子文件夹.

Yes, you can define in one repo a parent pom, declaring a multi-module maven project, each module referring to a subfolder.

可以通过git submodule add命令创建这些子文件夹,每个子文件夹都引用一个对子项目进行版本控制的远程存储库. 子文件夹相对于父目录的根文件夹,但不需要../.

Those subfolders can be created through git submodule add command, referencing each a remote repository where the sub-project is versioned.
The subfolders are relative to the root folder of the parent directory, but should not need ../.

每个子模块存储库都可以有自己的pom.xml,它将主prom pom称为父pom.

Each submodule repo can have its own pom.xml, which would reference the main projet pom as a parent pom.

这篇关于如何拆分git repo并应用Maven子模块和Maven父级?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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