首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >管理多模块项目

管理多模块项目
EN

Stack Overflow用户
提问于 2019-07-16 07:54:01
回答 1查看 813关注 0票数 1

当前设置:

  1. Maven
  2. Spring Boot
  3. 角度
  4. 12个maven项目+1个Pom项目
  5. Git
  6. 詹金

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

寻找

  1. 一旦我克隆了单个pom/主项目,所有其他项目都应该被克隆。
  2. 如果我接受主项目的拉动,那么所有其他项目代码都应该得到更新。
  3. 每次我开始建詹金的时候,孩子项目都应该得到头版的修改。
  4. 希望为每个子项目保留单独的回购,以便可以在其他项目中重用它,因为我有多个需求。

我想过的解决办法:

  1. Maven儿童项目
  2. Git子模

上述解决方案面临的问题

代码语言:javascript
复制
 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.

是否有解决所有问题的最佳办法。

EN

回答 1

Stack Overflow用户

发布于 2019-07-16 09:27:05

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

为不同存储库中的项目创建git子模块

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

您可以采取的步骤如下:

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

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

我建议您阅读链接,并确保您的需求得到了满足。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57052536

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档