javaeclipsegitdirectorybndtools

How to use multiple git repositories in one bndtools workspace


I am using eclipse BndTools with a few dedicated workspaces each stored in a single git repo and I've been quite happy sofar.

I've been sharing projects between workspaces by copying them. But recently decided to pull common code into a shared code git repository. In eclipse this is trivial, just use subfolders in your workspace, one per repository.

However to my surprise bndtools demands that I place one cnf project next to my projects in the filebase. At the same time I can only have one cnf project in my workspace. Which effectively means ALL my projects should be peers.

Which in turn means I cannot use multiple git repositories as they cannot share the same directory. Unless I split each project into it's own repository and with 50+ projects this is clearly not where I want to go.

I know eclipse can do this, but is there a way to get bndtools to play ball?


Solution

  • Which effectively means ALL my projects should be peers.
    ...

    Which in turn means I cannot use multiple git repositories as they cannot share the same directory. Unless I split each project into it's own repository

    This is where submodule is coming for rescue.

    Submodules allow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit.

    enter image description here


    How to use submodules

    # Create each project in its own repository
    
    # now add the desired submodule to your project
    git submodule add <url>
    
    # now init/update one by one or recursively all at once
    git submodule init
    git submodule update