为什么 Eclipse 试图将我的 .svn 文件夹从 src 复制到 bin,我该如何让它停止?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1709810/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why is Eclipse trying to copy my .svn folders from src to bin, and how can I make it stop?
提问by Jeremy
I have checked out a bunch of java code using subversion 1.6 and then I imported those projects into eclipse. Subclipse 1.6 picked up the fact that the plugins are under version control, except for a few folders.
我已经使用 subversion 1.6 检查了一堆 java 代码,然后我将这些项目导入到 eclipse 中。Subclipse 1.6 发现插件受版本控制,除了几个文件夹。
I now get a bunch of errors like:
我现在收到一堆错误,例如:
The resource is a duplicate of src/.svn/all-wcprops and was not copied to the output folder
该资源是 src/.svn/all-wcprops 的副本,未复制到输出文件夹
If I delete the project (from eclipse not on disk) and reimport it, that fixes the problem about half the time. But since I have dozens of projects that are having this problem, it means reimporting them 10-20 times before I get them all working. This is very painful, and I am tired of doing it every time someone adds a new plugin to svn or when I need to recreate a workspace for some reason.
如果我删除项目(从 eclipse 不在磁盘上)并重新导入它,大约有一半的时间可以解决问题。但是由于我有几十个项目存在这个问题,这意味着在我让它们全部工作之前重新导入它们 10-20 次。这是非常痛苦的,每次有人向 svn 添加新插件或出于某种原因需要重新创建工作区时,我都厌倦了这样做。
Is there an easier way to fix this than delete and reimport? Or is there a way to prevent this problem in the first place?
有没有比删除和重新导入更简单的方法来解决这个问题?或者有没有办法首先防止这个问题?
采纳答案by user245075
This is happening because you checked out a project using an SVN client other than Eclipse and then imported the project in Eclipse and you haven't notified Eclipse that this is an SVN project (that is, Eclipse doesn't know it has to ignore the SVN meta information).
发生这种情况是因为您使用 Eclipse 以外的 SVN 客户端签出一个项目,然后将该项目导入到 Eclipse 中,并且您没有通知 Eclipse 这是一个 SVN 项目(也就是说,Eclipse 不知道它必须忽略SVN 元信息)。
In order to fix this properly, after you have imported the project in Eclipse, have Eclipse be 'aware' of the SVN nature of the project. Do so by
为了正确解决此问题,在 Eclipse 中导入项目后,让 Eclipse '了解'项目的 SVN 性质。这样做
- Select the project and go to the Team > Share section.
- A dialog will appear asking weather this is a CVS or SVN project. Select the later.
- It will prompt for the credentials, enter them.
- When you're done, do a clean build. The problem goes away.
- 选择项目并转到团队 > 共享部分。
- 将出现一个对话框,询问天气这是 CVS 或 SVN 项目。选择后者。
- 它将提示输入凭据,输入它们。
- 完成后,进行干净的构建。问题消失了。
回答by Kelly S. French
Add the .svn folder to the Excluded list for your Source Folder.
将 .svn 文件夹添加到源文件夹的排除列表中。
- Project->Properties
- Java Build Path
- Source tab
- Select 'Excluded'
- click
- Click next to the Exclusion patterns section on the bottom
- Add the .svn folder and any others that do not need to be copied to the output directory
- 项目->属性
- Java 构建路径
- 源选项卡
- 选择“排除”
- 点击
- 单击底部排除模式部分旁边的
- 添加 .svn 文件夹和任何其他不需要复制到输出目录的文件夹
回答by Vladimir
Follow the procedure described by Kelly but define the exclusion pattern as **/.svn/*
. This will recursively exclude all .svn
directories from the various source folders.
遵循 Kelly 描述的过程,但将排除模式定义为**/.svn/*
。这将递归地.svn
从各种源文件夹中排除所有目录。
回答by azdev
Easier way to do this is:
更简单的方法是:
- Project > Properties
- Resource > Resource Filters > Add...
- Filter type > Exclude all
- Applies to > Folders
- Check All children (recursive)
- File and Folder Attributes > Type ".svn"
- Hit OK and OK again
- Clean/build
- 项目 > 属性
- 资源 > 资源过滤器 > 添加...
- 过滤器类型 > 排除所有
- 适用于 > 文件夹
- 检查所有孩子(递归)
- 文件和文件夹属性 > 键入“.svn”
- 再次点击 OK 和 OK
- 清理/构建
回答by HariKishore
------------ Simple way of filtering the output folder-------------
------------ 过滤输出文件夹的简单方法------------
Window->Preferences->Java->Compiler->Building
Make sure "Filtered Resources" includes ".svn/"
Window->Preferences->Java->Compiler->Building
确保“Filtered Resources”包含“.svn/”
回答by Oliver Meyer
The "accepted best answer" described the cause to me, but as my project was already shared, I 1. closed the project, 2. opend it again and 3. cleaned it. The .svn folder is gone and does not come back.
“公认的最佳答案”向我描述了原因,但由于我的项目已经共享,我 1. 关闭了项目,2. 再次打开它 3. 清理它。.svn 文件夹消失了,不会再回来了。