which eclipse files to exclude from subversion repo

dr jerry picture dr jerry · Feb 15, 2011 · Viewed 15.6k times · Source

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.

  • 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 ?

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.

Answer

fgysin reinstate Monica picture fgysin reinstate Monica · Feb 15, 2011

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:

  • source files, libraries, property files, .xml config, ...
  • built stuff, i.e. .class files, archives, ...

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

In Eclipse there is a 'global' ignore list for files which are shared to repositories via SVN, CVS, etc. You can find it here:

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.

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.

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 )

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...)