要从 subversion repo 中排除哪些 eclipse 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5002610/
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
which eclipse files to exclude from subversion repo
提问by dr jerry
We as a development team were always happy with subversion and eclipse, we checked in everything and everything was fine. Until we had a new hire who's using anything but eclipse (RAD ). his RAD checkins are currently polluting the svn repo withholding our eclipse checkouts to finish building. One solution may be to force eclipse in the new hirer's throat, another more subtle and probably more suitable approach is to make our project ide agnostic. Instead of removing the files by trial and error I hope to learn a quick and reliable solution.
我们作为一个开发团队总是对 subversion 和 eclipse 感到满意,我们检查了一切,一切都很好。直到我们有一个新员工使用除了 eclipse (RAD) 之外的任何东西。他的 RAD 签入目前正在污染 svn 回购,扣留我们的 Eclipse 签出以完成构建。一种解决方案可能是在新雇员的喉咙里强制 eclipse,另一种更微妙且可能更合适的方法是使我们的项目 ide 不可知。我希望学习一个快速可靠的解决方案,而不是通过反复试验来删除文件。
- I already learned that i should remove files and add them to the svn global ignore. I'm wondering is there a way to make this project wide instead of having everybody fixing their own svn config? Something to add to your root .svn directory?
- I'm also looking for a list or even script to remove the eclipse files and directories from the svn repo (.project .settings .classpath?? .externalToolBuilders .springBeans) without running the risk of completely ruining the workspace.
- I'm also intested in finding the quickest way of restoring the workspace, as we're using maven for software project management I can do mvn eclipse:eclipse in the root of workspace but how do I find what the proper WST settings are, and what is the quickest way or restoring your path settings in eclipse ?
- 我已经知道我应该删除文件并将它们添加到 svn 全局忽略。我想知道有没有办法让这个项目更广泛,而不是让每个人都修复自己的 svn 配置?要添加到您的根 .svn 目录中的内容吗?
- 我也在寻找一个列表甚至脚本来从 svn 存储库(.project .settings .classpath?? .externalToolBuilders .springBeans)中删除 eclipse 文件和目录,而不会冒完全破坏工作区的风险。
- 我也很想找到恢复工作区的最快方法,因为我们使用 maven 进行软件项目管理,我可以在工作区的根目录中执行 mvn eclipse:eclipse 但我如何找到正确的 WST 设置,以及在 eclipse 中恢复路径设置的最快方法是什么?
I thought that many people would have been faced with the same use case, and consequently had the same questions but I haven't found anything on Google yet. Hopefully somebody here can point me in the right direction.
我以为很多人会遇到相同的用例,因此会有相同的问题,但我还没有在 Google 上找到任何东西。希望这里有人能指出我正确的方向。
回答by fgysin reinstate Monica
If you want to have a language-agnostic code repository the question is less about which files to exclude that about which files to include. Meaning, in a language-agnostic repo there should really only be the files necessary for the project:
如果您想拥有一个与语言无关的代码存储库,那么问题就不是要排除哪些文件,而是要包含哪些文件。意思是,在与语言无关的 repo 中,实际上应该只有项目所需的文件:
- source files, libraries, property files, .xml config, ...
- built stuff, i.e. .class files, archives, ...
- 源文件、库、属性文件、.xml 配置、...
- 构建的东西,即 .class 文件,档案,......
You should certainly exclude:
你当然应该排除:
- .project - this is project specific config by eclipse
- .settings folder - this is project specific config by eclipse
- .classpath - also eclipse specific
- .project - 这是 eclipse 的项目特定配置
- .settings 文件夹 - 这是 eclipse 的项目特定配置
- .classpath - 也是eclipse特定的
In Eclipse there is a 'global' ignore listfor files which are shared to repositories via SVN, CVS, etc. You can find it here:
在 Eclipse 中,有一个“全局”忽略文件列表,用于通过 SVN、CVS 等共享到存储库的文件。您可以在此处找到它:
Window > Preferences > Team > Ignored Resources
If you're looking for something outside Eclipse, try the global-ignores config in your local subversion config. Add this to your ~/.subversion/config file.
如果您正在寻找 Eclipse 之外的东西,请尝试在您的本地 subversion 配置中使用 global-ignores 配置。将此添加到您的 ~/.subversion/config 文件中。
global-ignores = build *.mode* *.pbxuser *~.nib .DS_Store *~
Mind that if excluding the Eclipse config from the repos you'll have to set up your projects after a checkout more specifically.
请注意,如果从存储库中排除 Eclipse 配置,您将必须在更具体的结帐后设置您的项目。
However, as you say you're using Maven this should not pose too many problems for you actually. If the pom.xml files of maven projects are configured correctly and completely, you can easily import a project from SVN via 'Import as Maven Project' - Eclipse will do all the right config for you on the import. (For this you need the m2Eclipse Maven Plugin, but I guess you'll be using something like that already? Anyway, here's the link: http://m2eclipse.sonatype.org/sites/m2e)
但是,正如您所说,您使用的是 Maven,这实际上不会给您带来太多问题。如果 Maven 项目的 pom.xml 文件配置正确且完整,您可以通过“导入为 Maven 项目”轻松地从 SVN 导入项目 - Eclipse 会在导入时为您做所有正确的配置。(为此,您需要 m2Eclipse Maven 插件,但我猜您已经在使用类似的东西了?无论如何,这是链接:http: //m2eclipse.sonatype.org/sites/m2e)
As for your question concerning a script to clean the repo: I'm not aware of such a thing right now, and I'd be very careful with this. Sounds like a lotta things could go horribly wrong. ;)
至于你关于清理回购脚本的问题:我现在不知道这样的事情,我会非常小心。听起来很多事情可能会出错。;)
Last but not least, restoring the workspace: In my experience, it is often the easiest thing to just delete your project locally and to a fresh checkout 'as maven project'. This way Eclipse will reconfigure all the important stuff. I have spent hours on broken Eclipse config, sometimes it tends to just get stuck and fails to be able to recover - especially if you're working with a lot of plugins which tend to do some of their own configuration magic. (And happen to be not exactly bug free...)
最后但并非最不重要的是,恢复工作区:根据我的经验,在本地删除您的项目并重新签出“作为 maven 项目”通常是最简单的事情。这样 Eclipse 将重新配置所有重要的东西。我花了几个小时在损坏的 Eclipse 配置上,有时它往往会卡住并且无法恢复 - 特别是如果您正在使用很多插件,这些插件往往会做一些自己的配置魔术。(而且碰巧不是完全没有错误......)