简体   繁体   English

模块化Maven项目和多个Git存储库

[英]Modular Maven projects and multiple Git repositories

I have separated the code that I have been making up to this point from a single maven project to multiple maven projects. 我将到目前为止编写的代码从单个maven项目分离到了多个maven项目。 The projects that I have ended up with can be used by future projects, they are pretty much libraries. 我最终使用的项目可以被将来的项目使用,它们几乎是库。 I have been using a single Git repository up to this point since everything was in one project. 到目前为止,由于所有内容都在一个项目中,因此我一直在使用单个Git存储库。 However after the modularisation I wonder if I should create a Git repository for each Maven project. 但是,在模块化之后,我想知道是否应该为每个Maven项目创建一个Git存储库。 I think that is the correct way to do it, but I would like to hear what others think of that. 我认为这是正确的做法,但我想听听其他人对此的看法。 Since the projects could work as standalone components they also deserve their own Git repository? 由于这些项目可以作为独立的组件工作,因此它们也应该拥有自己的Git存储库吗? Another option would be to develop all the projects in the same Git repository for the project that I currently work on. 另一个选择是在我当前正在处理的项目的同一个Git存储库中开发所有项目。

Since the projects could work as standalone components they also deserve their own Git repository? 由于这些项目可以作为独立的组件工作,因此它们也应该拥有自己的Git存储库吗?

This is actually one of the main criteria for defining a git repo, which will represent a coherent group of file with its own independent history (including its set of branches and tags) 实际上,这是定义git repo的主要标准之一,它将代表具有各自独立历史记录(包括其分支和标签集)的连贯文件组

This has the additional advantage that some other project depending on some but not all your components won't have to clone the full unique git repo (which would contain everything , included components not needed). 这具有另一个优势,即依赖于某些但不是您所有组件的其他项目不必克隆完整的唯一git repo(它将包含所有内容 ,包括不需要的组件)。
That other project can clone and benefit from the exact subset of components needed. 该其他项目可以克隆所需组件的确切子集并从中受益。

This is called the component approach, as opposed to the system approach . 与系统方法相反,这称为组件方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM