6

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.

LuckyLuke
  • 47,771
  • 85
  • 270
  • 434
  • How you intend to use it would equally influence the decision. Are you more likely to fork the modules as standalone? – velo Jun 28 '13 at 22:59
  • This really comes down to, "How do you want to do it?". There's no "correct" answer to this. Either way is fine. – Brian Roach Jun 28 '13 at 23:39

1 Answers1

2

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    Yes exactly. I would add to this that you probably want to eliminate any parent pom you might have as well. That way, you can truly evolve both modules independently. If that is inconvenient because your modules are actually tightly coupled, modularizing is going to cause more problems than that it solves. This is a bit of an anti pattern in Java where people turn every package into a module and end up spending way too much time doing releases, builds, etc. – Jilles van Gurp Jun 29 '13 at 23:41