我正在向我们现有的代码库添加一个 eclipse 项目,我想知道是否有办法完全排除某些目录被 eclipse 拾取?原因是我们的存储库中有一个巨大的“第三方”目录,该目录不能出现在我们用来高效同步的结对编程插件的项目中。
有什么线索吗?
我正在向我们现有的代码库添加一个 eclipse 项目,我想知道是否有办法完全排除某些目录被 eclipse 拾取?原因是我们的存储库中有一个巨大的“第三方”目录,该目录不能出现在我们用来高效同步的结对编程插件的项目中。
有什么线索吗?
有一个直接的方法来做到这一点:
PS 如果您的项目树没有自动更新,您可能必须在 Project Explorer 窗口中输入焦点时按 F5。
过滤器将从视图中隐藏资源,但它们仍在项目中。如果您在其他位置创建项目,则可以将链接资源创建到要包含在项目中的文件夹。
作为参考,我发布了另一个答案,该答案更详细地描述了如何使用链接资源。
是的,您可以在项目中放置自定义过滤器。在您的项目浏览器视图中,Package Explorer 选项卡旁边的面板顶部附近应该有一个白色的向下箭头。单击它,然后转到过滤器。从那里,您可以通过选中名称过滤器模式旁边的框来指定您不希望检测到的某些文件夹模式。在这种情况下,我会输入第 3 方库的名称。
我一直这样做的方式是明确地检查项目作为同行。例如:
~/myworkspace/goodproject ~/myworkspace/3rdparty
然后只将“goodproject”导入eclipse。如果 "3rdparty" 是 goodproject 的子目录,你可以把它伪装出来......例如,你的 svn 项目看起来像这样:
项目/ 源/ 主要的/ 第三方/
您可以在本地创建项目/src/,然后只签出“主”目录,并让 eclipse 依赖于打包版本(例如,如果您的项目是 java,则指向 jar)。
如果你想直接在.project文件中添加过滤器,这些是一些规则:
<type>6</type> <!-- exclude all, files -->
<type>5</type> <!-- include only, files -->
<type>13</type> <!-- include only, files and folders -->
<type>26</type><!-- exclude all, folders, all children -->
<arguments>1.0-name-matches-false-false-xyz</arguments> <!-- case sensitive=false, regular expression=false, something named=xyz -->
<arguments>1.0-name-matches-true-false-EEE</arguments> <!-- case sensitive = true, regular expression = false, something named=EEE -->
<arguments>1.0-name-matches-false-false-www</arguments> <!--case sensitive=false, regular expression = false, something named=www -->
例如,一个.project过滤器部分:
<filteredResources>
<filter>
<id>1567020347706</id>
<name></name>
<type>6</type> <!-- exclude all, files -->
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-abc</arguments>
</matcher>
</filter>
<filter>
<id>1567020347708</id>
<name></name>
<type>5</type> <!-- include only, files -->
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-xyz</arguments> <!-- case sensitive=false, regular expression=false -->
</matcher>
</filter>
<filter>
<id>1567020347711</id>
<name></name>
<type>13</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-mno</arguments>
</matcher>
</filter>
<filter>
<id>1567020347713</id>
<name></name>
<type>26</type><!-- exclude all, folders, all children -->
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-true-false-EEE</arguments> <!-- case sensitive = true, regular expression = false -->
</matcher>
</filter>
<filter>
<id>1567020347716</id>
<name></name>
<type>26</type> <!-- exclude all, folders, all children -->
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-www</arguments> <!-- case sensitive = false, regular expression = false -->
</matcher>
</filter>
</filteredResources>