Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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. However after the modularisation I wonder if I should create a Git repository for each Maven project. 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? Another option would be to develop all the projects in the same Git repository for the project that I currently work on.

like image 315
LuckyLuke Avatar asked Jun 28 '13 22:06

LuckyLuke


People also ask

Can there be multiple repositories for each project?

Yes. You can put multiple projects in one Git repository but they would need to be on different branches within that repo.

What is a multi-module Maven project?

A multi-module project is built from an aggregator POM that manages a group of submodules. In most cases, the aggregator is located in the project's root directory and must have packaging of type pom. The submodules are regular Maven projects, and they can be built separately or through the aggregator POM.

Can you have multiple repositories in Git?

With Git, using multiple repositories is the only way to work efficiently. This enables each team to work independently, and do their work faster. You can also make sure that developers only have access to the repositories they need access to (thus making Git more secure.)


1 Answers

Since the projects could work as standalone components they also deserve their own Git repository?

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)

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).
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.

like image 54
VonC Avatar answered Oct 22 '22 00:10

VonC