Wednesday, October 05, 2011

Eclipse Dance Steps


Sometime Eclipse fails to work as expected. The following 'dances', in increasing order of desperation, may help. Remember to maintain a fixed grin throughout and try not to tread on your own toes.

Refresh and clean all projects ("Quickstep")

Click on a project in the Package Explorer. Hit Apple-A (or Ctrl-A) to select all projects. Hit F5 to refresh. Select Project->Clean..., select "Clean all projects", and click Ok.

Open and close all projects ("Foxtrot")

Click on a project in the Package Explorer. Hit Apple-A (or Ctrl-A) to select all projects. Right click the projects and select "Close Project". Right click the projects again and select "Open Project".

Open and close all projects restarting Eclipse in between ("Tango")

Click on a project in the Package Explorer. Hit Apple-A (or Ctrl-A) to select all projects. Right click the projects and select "Close Project". Restart Eclipse. Click on a project in the Package Explorer. Hit Apple-A (or Ctrl-A) to select all projects. Right click the projects again and select "Open Project".

Delete and re-import all projects ("Paso Doble")

Click on a project in the Package Explorer. Hit Apple-A (or Ctrl-A) to select all projects. Press the delete key, select "Do not delete contents", and click Ok. Right click in the Package Explorer and select Import..., then choose General and "Existing Projects into Workspace" and click Next. Browse to select the platform checkout directory and click Choose. Select all the projects for import. Click Finish.

Rebuild the search indices ("Slow Waltz")

Exit the workbench and delete the Java search index:
  • go into \plugins\.metadata\.plugins\org.eclipse.jdt.core
  • delete 'savedIndexNames.txt'
  • delete all *.index
    Restart

If all else fails

If you're still stuck, try the "Hokey Cokey" by repeating all of the above until you've had enough.

15 comments:

James said...

When using maven projects via m2e, there are a couple of extras (the combination are probably the Cha-cha-cha?):
Maven -> Update Project Configuration; Select All; Ok (and wait)
and
Maven -> Update Dependencies...; Select All; Ok (and wait)

And in a real emergency, open the Maven Repositories view and refresh the indexes on all repositories (and keep waiting).

Glyn said...

Thanks. I'd like to see the whole set of Maven dances, quite apart from under Eclipse. ;-)

Anonymous said...

Over the years one that often saved me is the moonwalk (aka PDE dance).
Step 1 - disable auto build
Step 2 - empty the target platform
Step 3 - restart eclipse
Step 4 - select the target platform again
Step 5 - build

Note though that some partners may decide to change on you Step 2 by picking another target platform.

As for the Maven dances, they can only be practiced on the slippery floor resulting from the usage of the IDE and Maven waxes together.

Anonymous said...

Thanks for this usefull and funny post ;-)

Anonymous said...

This is really funny cause in our team we call these Eclipse Dances too!

Zteve said...

Nice one Glyn.

Anonymous said...

How about "Dance another day"?

Once cleaning & rebuilding the recalcitrant project has failed to imrove things, I tend to start over with a new workspace into which I check out all projects.

Export -> Team -> Team Project Set in the bad workspace, Import ... in the new one.

I never needed it, but switching to a new/different install of Eclipse in the middle is entirely possible.

Anonymous said...

I feel the pain of these comments, but I'm disappointed that no one mentioned anything about fixing the underlying causes of these problems.

Furthermore, if there is a computational way to do this then it should be possible to execute a command which will do these things without requiring us to do them.

Glyn said...

We spoke to Eclipse experts about these issues, but it was too hard to reproduce the failures predictably and Eclipse doesn't really have sufficiently good diagnostics to enable a bad "one off" state to be debugged, so we gave up and kept "dancing".

Fortunately, or unfortunately from a debugging perspective, it is relatively rare to need any of the steps these days. Maybe I've subconsciously learned not to push Eclipse beyond its limits.

Anonymous said...

And here is the fix: use something else! Netbeans, IntelliJ Idea or even Notepad, as you wish :o)

Glyn said...

I've used IDEA and quite like it, but the dance steps are so rarely needed in Eclipse these days that I prefer it as I know the shortcuts and it's helpful to have OSGi as a plugin system.

Anonymous said...

don't forget about the "crusty shuffle", close Eclipse, delete your entire workspace, and reopen.

Anonymous said...

Thanks . This helped.

Alejandro Zalazar said...

Thanks! it is still helpful!

Unknown said...

Cleaning and rebuilding the project didn't work for me, but restarting eclipse with the -clean flag, followed by a rebuild did. E.g (from terminal):
"C:\Program Files\eclipse\eclipse.exe" -clean
followed by (inside eclipse) Project>Build Project

Projects

OSGi (130) Virgo (59) Eclipse (10) Equinox (9) dm Server (8) Felix (4) WebSphere (3) Aries (2) GlassFish (2) JBoss (1) Newton (1) WebLogic (1)