5

I recently wanted to adopt submodules from GIT with my Android projects but stumbled into some problems.

Backstory

I have multiple projects but many use the same external library (Android library-project), in order to make the GIT cleaner and make the GIT for each project contain all the needed material I though of using GIT sub-modules for the Android library project. This part works fine I got the library included as a sub-module for the projects.

Issue

But Android uses these library-projects which basically is a regular project which is added to the project and I can only add the same project once in Eclipse. So if I need to work on more than one project at a time I have to use multiple instances of Eclipse/workspace instead of using Eclipse the regular way.

Is there a way to have only 1 instance of my library project in eclipse and at the same time have all the projects reference to their respective libraries? Or any other suggestions how I should handle this?

Any help is very appreciated

4

1 回答 1

2

由于以下原因,您不能将库项目作为 Eclipse 中的单个实例。

  • 使用该库的每个项目都可能引用该库的不同版本。由于您的子模块是特定版本的物理检出(工作目录),因此无法在某个时间点表示存储库的多个状态。

解决方法:

  1. 为库项目准备一个“服务器”位置。使用git clone --bare.
  2. 将“服务器”库项目克隆到您的工作区。
  3. 为库项目添加前缀以反映使用它的主项目的名称。
  4. 对您需要使用该库的每个主要项目重复第 2 步和第 3 步。
  5. 每次您在库项目中进行更改时,都会创建一个功能分支。在每个主要项目中,考虑新功能是否有用或阻碍。如果它不适合您显然需要重写您刚刚创建的功能。完成后更新库的版本(不要害羞使用带有Semantic Versioning的标签)。
于 2013-05-03T09:49:19.950 回答