bhantol
bhantol

Reputation: 9616

Is it best practice to place Java project directly under the Source Code Repository

Any pros and cons or creating additional folders under a repository ?

The example scenario below elaborates the question further:-

e.g. Say we are using Git as an SCM.

Option 1

myrepository/my-favorite-maven-project-1
                    |____pom.xml

            /my-favorite-maven-project-2
                    |____pom.xml

Option 2

myrepository/SomeFolder1/my-favorite-maven-project-1
                    |____pom.xml

            /SomeFolder1/SomeFolder2/my-favorite-maven-project-2
                    |____pom.xml

I would like to get pros and cons with the Option 1 and Option 2.

Upvotes: 3

Views: 116

Answers (1)

AlBlue
AlBlue

Reputation: 24060

Putting multiple maven projects under a single git repository makes sense if both of the projects are in fact modules of each other and they are released/branched at the same time.

It's a mistake if you're moving from SVN where you've had a single large SVN repo and lots of projects next to each other though. The reason is, SVN branches/tags work at the folder level, but in Git they work at the repository level. So if you're branching/releasing project-1 and project-2 separately, they should be in separate Git repositories.

The corollary is that there's very little point in having a top level folder SomeFolder1 because there's almost no reason you'd ever have a SomeFolder2.

Upvotes: 4

Related Questions