Thursday, April 5, 2012

How to hard reboot out of Scala/Eclipse re-build hell

I find it hard to believe that I am the only person who is occasionally stuck in eclipse workspace-rebuild hell. The workspace simply does not clean or rebuild as it is supposed to, or takes an extraordinarily long time. I understand the reasons include the complex type inference and the fact that Eclipse doesn't really take not of updates cleanly. Anyway:
  1. Blow away all your code (just for fun, mostly). 
  2. If you weren't using source control, what the hell is wrong with you?
  3. Delete all your packages in Eclipse - (moderately satisfying)
  4. Blow away project properties directory called project  (not sure if this is strictly necessary but it feels terrific)
  5. Pull a clean copy of your code and everyone else's
  6. Start over. Run  ./sbt nars eclipse    - or whatever. File->Import->General->Existing Projects into Workspace
I find this usually does the trick, but would appreciate thoughts from an expert on why it should be this hard. Thanks to Dan Glaser by the way. 

1 comment:

  1. (deleted my previous comment - weird formatting)
    I switched to IntelliJ after using Eclipse for many, many years - I've often felt Eclipse wasn't quite right for me.

    I've just finished my 30d trial of IntelliJ and happily splashed out to buy a license because it suits ME better. It's especially sweet for Scala development.

    I'm not suggesting it's perfect, but worth a try if you haven't already.