Reputation: 969
Current setup:
Currently i have separate 13 project. Every time if i have to setup on another machine then i have to clone each project individually. Also i did the Jenkin pipeline setup for auto build.
Looking for
- Once i clone the single pom/main project , all other project should get cloned
- If i take pull of the main project then all other projects code should get updated
Child project should get head revision every time i start the jenkin build.
Want to keep separate repo for each sub projects so that it can be reuse in other project as i have multiple requirements.
Solution that i have thought of:
Issues facing in above solution
1. Maven Child projects
--> If we are using maven child projects then we are literally copying the sub projects in pom/main project.
In this case i cannot reuse the project. Every time i have to clone the project to use it.
For big project with number of team member working, merging issue will come.
2. Git Sub modules
--> This is best solution for me but when we create sub module it always point to commit not the head revision.
Every time i have to manually pull the latest code push it to parent project.
This approach we can not use in Jenkins.
Is there best approach which can resolve all the issue.
Upvotes: 1
Views: 1129
Reputation: 7505
You can add git sub-modules by specifying what modules to be added from other repositories. A .gitmodules
file will be created on root that will contain list of all submodules and other preferences of yours.
Creating git submodules for projects in different repositories
There are set of commands available that you can use to sync up the git module and all it's sub-modules.
Set of steps that you could take is:
git submodule add [ssh or https path]
e.g. git submodule add https://github.com/test
git submodule init
git submodule update
or alternatively run git clone --recurse-submodules https://github.com/chaconinc/MainProject
to get sub-modules as well
I would recommend that you read through this link and ensure your requirement is fulfilled by this.
Upvotes: 1