Package Manager vs. Git Submodule/Subtree

后端 未结 2 1708
臣服心动
臣服心动 2021-02-04 04:22

Are there any reasons to use a package manager rather than git submodules/subtrees, or vice versa? The git solutions seem to be a lot more hassle than a simple package manager.<

2条回答
  •  广开言路
    2021-02-04 05:11

    The git solutions seem to be a lot more hassle than a simple package manager.

    This is not about hassle.

    This is about two different ways to build a project:

    1. through binary dependencies, with a package manager (Nexus, or Conan for C++: you declare your dependencies, and the package manager fetches them and uses them during the compilation.
      That is what a pom.xml or a npm-package.json: just one more file within your unique codebase, which will instruct the compiler to download the relevant dependencies
    2. through source dependencies, with Git submodules or subtrees, where you store references to other source code, import them, and recompile everything.
      For instance, if your system is composed of a front-end GUI sources and a backend sources, you could reference both repositories within one parent project repositories, combining their sources into one code base.

    The first is good when building a system, where each part has its own release lifecycle, and you want to depend to pre-built dependencies.

    The second is used when the dependencies are more tightly linked to the main program.

    Or when there are no binary dependencies (which is the case, for instance, with Go and its modules).

提交回复
热议问题