gpt4 book ai didi

android - Eclipse:将一个项目添加到另一个项目的构建路径时如何忽略.git subdir?

转载 作者:太空狗 更新时间:2023-10-29 12:58:35 25 4
gpt4 key购买 nike

我正在开发一个应该在 Android 和常规 Java SE 上运行的应用程序。

我有一个名为foobar-core 的eclipse 项目,其中包含Android 和SE 版本都使用的代码。我有另一个名为 foobar-android 的项目,其中包含所有特定于 android 的代码。

我需要引用foobar-android项目中的一些foobar-core代码,所以我将foobar-core添加到< strong>foobar-android 在 Settings -> Java Build path -> Projects -> Required projects on the build path.这很好用,因为我现在可以在 foobar-android 中使用来自 foobare-core 的代码。

问题来了:foobar-corefoobar-android 都是独立的 git 存储库,这意味着它们都有一个 .git 子目录。现在,每当我编译 foobar-android 时,“控制台”选项卡上都会收到很多警告。它们看起来像这样:

/foobar-core/src/.git/HEAD conflicts with another file already put at .git/HEAD
/foobar-core/src/.git/config conflicts with another file already put at .git/config
/foobar-core/src/.git/description conflicts with another file already put at > .git/description
/foobar-core/src/.git/hooks/applypatch-msg.sample conflicts with another file already > put at .git/hooks/applypatch-msg.sample

从 foobar-core 项目导入源代码时,如何让 Eclipse 忽略 .git 文件?

最佳答案

即使您只有一个 git 存储库,也最好忽略 .git 目录,因为其他 Eclipse 会浪费大量时间查看其中的文件,即使它从不需要对它们做任何事情。特别是,当您进行项目范围的搜索时,Eclipse 将搜索 .git 目录中的所有文件,这会花费很长时间并最终向您显示大量重复项(或几乎重复项,同一文件的旧版本找到相同的搜索词)。

我认为 Eclipse git 扩展可能会解决这个问题,但如果您不想安装另一个扩展,我发现最好的方法是告诉 Eclipse 所有 .git 目录都是“派生的”,这似乎让 Eclipse 在某种程度上忽略包含的文件。

您可以通过从 Package Explorer View 切换到 Navigator View 来执行此操作,您应该会在其中看到 .git 文件夹。右键单击 .git 文件夹,选择属性,从设置选择器中选择资源,然后选中“派生”框。

关于android - Eclipse:将一个项目添加到另一个项目的构建路径时如何忽略.git subdir?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3176260/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com