简体   繁体   中英

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:-

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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