【问题标题】:Manage multi module project管理多模块项目
【发布时间】:2019-11-24 21:52:21
【问题描述】:

当前设置:

  1. 马文
  2. 春季启动
  3. 角度
  4. 12个maven项目+1个Pom项目
  5. 吉特
  6. 詹金

目前我有单独的 13 个项目。 每次如果我必须在另一台机器上进行设置,那么我必须单独克隆每个项目。 我还为自动构建做了 Jenkins 管道设置。

寻找

  1. 一旦我克隆了单个 pom/main 项目,所有其他项目都应该被克隆
  2. 如果我拉取主项目,那么所有其他项目的代码都应该更新
  3. 每次我启动 jenkin 时,子项目都应该得到 head revision 构建。

  4. 希望为每个子项目保留单独的 repo,以便在其他项目中重复使用,因为我有多个需求。

我想到的解决方案:

  1. Maven 子项目
  2. Git 子模块

上述解决方案面临的问题

 1. Maven Child projects
 --> If we are using maven child projects then we are literally copying the sub projects in pom/main project. 
In this case i cannot reuse the project. Every time i have to clone the project to use it. 
For big project with number of team member working, merging issue will come.

2. Git Sub modules
--> This is best solution for me but when we create sub module it always point to commit not the head revision.
Every time i have to manually pull the latest code  push it to parent project.
This approach we can not use in Jenkins.

是否有可以解决所有问题的最佳方法。

【问题讨论】:

标签: java git maven spring-boot jenkins


【解决方案1】:

您可以通过指定要从其他存储库添加的模块来添加 git 子模块。将在根目录上创建一个 .gitmodules 文件,其中包含所有子模块的列表和您的其他首选项。

Creating git submodules for projects in different repositories

您可以使用一组命令来同步 git 模块及其所有子模块。

您可以采取的步骤如下:

  1. 使用git submodule add [ssh or https path] 添加项目中的所有子模块,例如git submodule add https://github.com/test
  2. 添加其他子模块并推送更改
  3. 通过运行获取子模块内容
git submodule init
 git submodule update

或者也可以运行git clone --recurse-submodules https://github.com/chaconinc/MainProject 来获取子模块

我建议您通读this 链接并确保您的要求得到满足。

【讨论】:

  • 我已经试过了。但每次我必须更新每个子模块
  • 我认为您必须花一些时间阅读相同的内容并进行更多探索。无论如何stackoverflow.com/questions/1030169/… 对此有所帮助。
猜你喜欢
  • 1970-01-01
  • 2011-10-14
  • 2011-03-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-27
相关资源
最近更新 更多