I know there are multiple posts on similar problems, so please be kind with me. I am asking for suggestions I have not thought of and for good advice.
I have a java "project" that is structured in a server-client pattern.
There are some classes that are common to both parts but most of it is either server (backend and control logic) or client (GUI). To not write one monolithic application (where the client depends on JDBC
jars) I decided to split the project into multiple eclipse projects:
proj_server
(whereJDBC
is needed)proj_client
proj_common
proj_test
In proj_test
there is some code to test parts of the client/server. I setup eclise such that both server and client depend on the common module.
Now I use git to manage all these eclipse projects.
My first thought was to manage all parts in separate repos as suggested by git.
But I have the problem that I loose the relation of the different commits: Any modification in the proj_common
will typically reflect some data type modification. This makes the new version incompatible with old commit in the other projects.
I then thought of several possibilities:
- Using of
git submodules
- Using of
git subtree
- Using of a single git repository that contains the modules together
- Using different repositories and adding regularly tags to the commits to keep track of the relations
The solution 1 has the problem that it is quite heavy to maintain. Especially if you want to check in multiple small modifications you have to go multiple times "around the folders" to add
/commit
and then pack it all in the main repository up.
The subtree
method might work well as far as I have read with a bunch of scripts to manage the git calls. The main disadvantage is that subtree
fits perfectly if most work is done in the main repository and updates to the imported repos happen occasionally. If the updates happen merely in the subprojects the history of the main projects gets quite crumpled.
On branching it might get complicated.
The solution number 3 is my favourite solution so far as everything is kept tight and branching is done without any problem.
The solution 4 is mainly what is done now, but no tag have been created yet (pre-alpha, thus no sense in creating tags). As the project grows this might get also very nasty and error-prone.
What would you suggest? One of the given solutions or did I miss the one perfect solution?